From dbac5d205f31a1f4f639da7b88289e6d49f9af3c Mon Sep 17 00:00:00 2001
From: Markus Scheidgen <markus.scheidgen@gmail.com>
Date: Thu, 24 Oct 2019 13:20:46 +0200
Subject: [PATCH] Do not list always restricted files.

---
 nomad/files.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nomad/files.py b/nomad/files.py
index 7f1033734f..2f0aa4d273 100644
--- a/nomad/files.py
+++ b/nomad/files.py
@@ -808,7 +808,8 @@ class PublicUploadFiles(UploadFiles):
                     content_path = path[directory_len + (0 if directory_len == 0 else 1):]
                     if path.startswith(directory) and '/' not in content_path:
                         if '/' not in content_path:
-                            results.append((content_path, zf.getinfo(path).file_size))
+                            if not always_restricted(content_path) or self._is_authorized:
+                                results.append((content_path, zf.getinfo(path).file_size))
                         else:
                             # this asserts that sub directories are always behind their
                             # parents and file siblings
-- 
GitLab