[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Strip the filepath from input_store listing



commit baa505da2dcd2cf69e58fe212a2bc8478cf99617
Author: Arturo Filastò <arturo@xxxxxxxxxxx>
Date:   Sun Sep 18 16:41:38 2016 +0200

    Strip the filepath from input_store listing
---
 ooni/deck/store.py    | 4 ++--
 ooni/ui/web/server.py | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ooni/deck/store.py b/ooni/deck/store.py
index f30b0d6..3e20e01 100644
--- a/ooni/deck/store.py
+++ b/ooni/deck/store.py
@@ -115,7 +115,7 @@ class InputStore(object):
         if self._cache_stale:
             self._update_cache()
         try:
-            input_desc = self._cache[input_id]
+            input_desc = deepcopy(self._cache[input_id])
         except KeyError:
             raise InputNotFound(input_id)
         return input_desc
@@ -190,7 +190,7 @@ class DeckStore(object):
         if self._cache_stale:
             self._update_cache()
         try:
-            return self._cache[deck_id]
+            return deepcopy(self._cache[deck_id])
         except KeyError:
             raise DeckNotFound(deck_id)
 
diff --git a/ooni/ui/web/server.py b/ooni/ui/web/server.py
index cee42ce..eec82d3 100644
--- a/ooni/ui/web/server.py
+++ b/ooni/ui/web/server.py
@@ -474,7 +474,7 @@ class WebUIAPI(object):
 
         except errors.InsufficientPrivileges:
             raise WebUIError(
-                400, 'Insufficient priviledges'
+                400, 'Insufficient privileges'
             )
         except:
             raise WebUIError(
@@ -511,8 +511,10 @@ class WebUIAPI(object):
     @xsrf_protect(check=False)
     @requires_true(attrs=['_is_initialized'])
     def api_input_details(self, request, input_id):
+        input_desc = self.director.input_store.get(input_id)
+        input_desc.pop('filepath')
         return self.render_json(
-            self.director.input_store.get(input_id), request
+            input_desc, request
         )
 
     @app.route('/api/measurement', methods=["GET"])



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits