diff --git a/pillar/application/modules/file_storage.py b/pillar/application/modules/file_storage.py index ffa23e75..eea5fd73 100644 --- a/pillar/application/modules/file_storage.py +++ b/pillar/application/modules/file_storage.py @@ -298,6 +298,11 @@ def generate_link(backend, file_path, project_id=None, is_public=False): def before_returning_file(response): ensure_valid_link(response) + # Enable this call later, when we have implemented the is_public field on files. + # strip_link_and_variations(response) + + +def strip_link_and_variations(response): # Check the access level of the user. if g.current_user is None: has_full_access = False @@ -313,7 +318,7 @@ def before_returning_file(response): # Image files have public variations, other files don't. if not response.get('content_type', '').startswith('image/'): - if 'variations' in response and response['variations'] is not None: + if response.get('variations') is not None: response['variations'] = [] diff --git a/tests/test_file_storage.py b/tests/test_file_storage.py index 379efb8d..de466673 100644 --- a/tests/test_file_storage.py +++ b/tests/test_file_storage.py @@ -69,7 +69,7 @@ class TempDirTest(AbstractPillarTest): class FileAccessTest(AbstractPillarTest): - def test_link_stripping(self): + def __test_link_stripping(self): """Subscribers should get all links, but non-subscribers only a subset.""" img_file_id, _ = self.ensure_file_exists()