From 81544a8ab165892fb0f5a1d6b237298cc1e216e4 Mon Sep 17 00:00:00 2001 From: alec_dev Date: Wed, 29 Jan 2025 16:56:41 -0600 Subject: [PATCH 1/3] The default coll parameter to assets is the database name --- specifyweb/attachment_gw/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/specifyweb/attachment_gw/views.py b/specifyweb/attachment_gw/views.py index 29eeeb67225..a1bbfaa9de0 100644 --- a/specifyweb/attachment_gw/views.py +++ b/specifyweb/attachment_gw/views.py @@ -66,8 +66,11 @@ def get_collection(request=None): # do any better than using the first collection # and hoping that all the assets are in the same # folder. - from specifyweb.specify.models import Collection - return Collection.objects.all()[0].collectionname + # from specifyweb.specify.models import Collection + # return Collection.objects.all()[0].collectionname + + # The default coll parameter to assets is the database name + return settings.DATABASE_NAME @openapi(schema={ "get": { From 0b5dc025b59fd8cf5c712f5886d7a73eab1f10bd Mon Sep 17 00:00:00 2001 From: alec_dev Date: Fri, 31 Jan 2025 13:44:21 -0600 Subject: [PATCH 2/3] Edit setting WEB_ATTACHMENT_COLLECTION --- specifyweb/settings/specify_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/settings/specify_settings.py b/specifyweb/settings/specify_settings.py index db767dbe660..9205c5e14c0 100644 --- a/specifyweb/settings/specify_settings.py +++ b/specifyweb/settings/specify_settings.py @@ -30,7 +30,7 @@ WEB_ATTACHMENT_KEY = None # The collection name to use with the web attachment server. -WEB_ATTACHMENT_COLLECTION = None +WEB_ATTACHMENT_COLLECTION = os.environ.get('WEB_ATTACHMENT_COLLECTION', DATABASE_NAME) # If True, and WEB_ATTACHMENT_COLLECTION is None, attachments for each # collection would be stored in separate folders From e322610b314899505cc46c29f72b8458b5efb8f9 Mon Sep 17 00:00:00 2001 From: alec_dev Date: Fri, 31 Jan 2025 13:47:18 -0600 Subject: [PATCH 3/3] handle being set to None in env --- specifyweb/settings/specify_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/settings/specify_settings.py b/specifyweb/settings/specify_settings.py index 9205c5e14c0..b1afa2bb177 100644 --- a/specifyweb/settings/specify_settings.py +++ b/specifyweb/settings/specify_settings.py @@ -30,7 +30,7 @@ WEB_ATTACHMENT_KEY = None # The collection name to use with the web attachment server. -WEB_ATTACHMENT_COLLECTION = os.environ.get('WEB_ATTACHMENT_COLLECTION', DATABASE_NAME) +WEB_ATTACHMENT_COLLECTION = os.environ.get('WEB_ATTACHMENT_COLLECTION', DATABASE_NAME) or DATABASE_NAME # If True, and WEB_ATTACHMENT_COLLECTION is None, attachments for each # collection would be stored in separate folders