From 0abcca85f4d816b71503b431193741f773a307a8 Mon Sep 17 00:00:00 2001 From: Jarosenb Date: Fri, 28 Jan 2022 13:25:04 -0600 Subject: [PATCH 1/3] allow downloads from nees.public --- server/main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/main.py b/server/main.py index 2f10373..10a29db 100644 --- a/server/main.py +++ b/server/main.py @@ -37,6 +37,8 @@ def get_system_root(system: str) -> str: root_dir = "/corral-repl/tacc/NHERI/community" case "designsafe.storage.published": root_dir = "/corral-repl/tacc/NHERI/published" + case "nees.public": + root_dir = "/corral-repl/tacc/NHERI/public/projects" case prj_system if system.startswith("project-"): project_id = prj_system.split("-", 1)[1] root_dir = os.path.join("/corral-repl/tacc/NHERI/projects", project_id) @@ -62,7 +64,6 @@ def walk_archive_paths(base_path: str, file_paths: List[str]) -> List[Archive]: size = 0 for file in file_paths: full_path = base / file.strip("/") - print(full_path) if full_path.is_file(): zip_paths.append({"fs": str(full_path), "n": full_path.name}) @@ -121,7 +122,11 @@ def check_downloadable( request: CheckRequest, auth: http.HTTPAuthorizationCredentials = Depends(HTTPBearer(auto_error=False)), ): - PUBLIC_SYSTEMS = ["designsafe.storage.community", "designsafe.storage.published"] + PUBLIC_SYSTEMS = [ + "designsafe.storage.community", + "designsafe.storage.published", + "nees.public", + ] if not auth and request.system not in PUBLIC_SYSTEMS: raise HTTPException( status_code=401, From 57955a9a95019be23b188d79fe8e15a370452456 Mon Sep 17 00:00:00 2001 From: Jarosenb Date: Fri, 28 Jan 2022 13:29:17 -0600 Subject: [PATCH 2/3] update tests --- server/tests/test_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/tests/test_utils.py b/server/tests/test_utils.py index f95bc78..2075459 100644 --- a/server/tests/test_utils.py +++ b/server/tests/test_utils.py @@ -18,6 +18,10 @@ def test_get_system_root(): get_system_root("designsafe.storage.published") == "/corral-repl/tacc/NHERI/published" ) + assert ( + get_system_root("nees.public") + == "/corral-repl/tacc/NHERI/public/projects" + ) assert ( get_system_root("project-7448086614930166251-242ac113-0001-012") == "/corral-repl/tacc/NHERI/projects/7448086614930166251-242ac113-0001-012" From 27acc6def6c9fd092e4c33f53ea6a17cf4eed759 Mon Sep 17 00:00:00 2001 From: Jarosenb Date: Fri, 28 Jan 2022 13:30:08 -0600 Subject: [PATCH 3/3] update tests --- server/tests/test_utils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/server/tests/test_utils.py b/server/tests/test_utils.py index 2075459..2c5d541 100644 --- a/server/tests/test_utils.py +++ b/server/tests/test_utils.py @@ -18,10 +18,7 @@ def test_get_system_root(): get_system_root("designsafe.storage.published") == "/corral-repl/tacc/NHERI/published" ) - assert ( - get_system_root("nees.public") - == "/corral-repl/tacc/NHERI/public/projects" - ) + assert get_system_root("nees.public") == "/corral-repl/tacc/NHERI/public/projects" assert ( get_system_root("project-7448086614930166251-242ac113-0001-012") == "/corral-repl/tacc/NHERI/projects/7448086614930166251-242ac113-0001-012"