diff --git a/media_serve/urls.py b/media_serve/urls.py index 0f82769b..074df3b0 100644 --- a/media_serve/urls.py +++ b/media_serve/urls.py @@ -4,15 +4,11 @@ from . import views urlpatterns = [ - # path("pdbs//", views.prot_download, name="get_protein"), - # path("pdbs/", views.prot_download, name="get_protein"), - # re_path(r"^pdbs/(?P.+)", views.prot_download, name="get_protein"), + re_path(r"^pdbs/(?P.+)", views.prot_download, name="get_protein"), path("bound//", views.bound_download, name="get_bound"), path("metadata//", views.metadata_download, name="get_metadata"), path("targets//", views.archive_download, name="get_archive"), path("maps//", views.map_download, name='get_map'), - # path("target_loader_data/", views.file_download, name='get_file'), - # re_path(r"^target_loader_data/48225dbf-204a-48e1-8ae7-f1632f4dba89/Mpro-v2/Mpro/upload_2/aligned_files/Mpro_Nterm-x0029/(?P.+)", views.file_download, name='get_file'), re_path(r"^target_loader_data/(?P.+)", views.tld_download, name="get_tld"), re_path(r"^pdbs/(?P.+)", views.file_download, name="get_file"), ] diff --git a/viewer/target_loader.py b/viewer/target_loader.py index 56fac359..ec0457f5 100644 --- a/viewer/target_loader.py +++ b/viewer/target_loader.py @@ -1,3 +1,4 @@ +import os from dataclasses import dataclass from typing import Any import logging @@ -1336,6 +1337,8 @@ def load_target( target_loader.abs_final_path.parent.joinpath(target_loader.data_bundle) ) + set_directory_permissions(target_loader.abs_final_path, 0o755) + update_task(task, "SUCCESS", upload_report) target_loader.experiment_upload.message = upload_report @@ -1355,3 +1358,16 @@ def update_task(task, state, message): except AttributeError: # no task passed to method, nothing to do pass + + +def set_directory_permissions(path, permissions): + for root, dirs, files in os.walk(path): + # Set permissions for directories + for directory in dirs: + dir_path = os.path.join(root, directory) + os.chmod(dir_path, permissions) + + # Set permissions for files + for file in files: + file_path = os.path.join(root, file) + os.chmod(file_path, permissions)