From 8ebe1fbfb784bc1809ebbb8ece0c61fc4ec0db71 Mon Sep 17 00:00:00 2001 From: Tianyi Wang <90009613+tiwa1154@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:15:20 -0400 Subject: [PATCH] Fix for eTag (#349) (#350) Changes to be committed: modified: biocompute/services.py modified: config/settings.py Co-authored-by: Hadley King --- biocompute/services.py | 3 ++- config/settings.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/biocompute/services.py b/biocompute/services.py index 90a3d35..4c75463 100644 --- a/biocompute/services.py +++ b/biocompute/services.py @@ -438,6 +438,7 @@ def create(self, validated_data): ) bco_instance.authorized_users.set(authorized_users) + bco_instance.save() return bco_instance def validate_bco_object_id(object_id: str, prefix_name: str): @@ -532,7 +533,7 @@ def generate_etag(bco_contents: dict) -> str: - str: A SHA-256 hash string acting as the etag for the BCO. """ - + bco_contents_copy = copy.deepcopy(bco_contents) for key in ['object_id', 'spec_version', 'etag']: diff --git a/config/settings.py b/config/settings.py index 52ed91d..0530860 100644 --- a/config/settings.py +++ b/config/settings.py @@ -23,6 +23,7 @@ HUMAN_READABLE_HOSTNAME = secrets["SERVER"]["HUMAN_READABLE_HOSTNAME"] PUBLIC_HOSTNAME = secrets["SERVER"]["PUBLIC_HOSTNAME"] EMAIL_BACKEND = secrets["SERVER"]["EMAIL_BACKEND"] + CORS_ORIGIN_WHITELIST = ["http://localhost:3000"] except KeyError: SECRET_KEY="^2uql114+yy0d$xv6+lm8*#1=uxs_oa0zw0bvu^fpi4tc9x0i" @@ -37,7 +38,8 @@ DATABASE="db.sqlite3" EMAIL_BACKEND="django.core.mail.backends.console.EmailBackend" CORS_ORIGIN_ALLOW_ALL = True - CORS_ORIGIN_WHITELIST = ["*"] + CORS_ORIGIN_WHITELIST = ["http://localhost:3000"] + # Use the REST framework REST_FRAMEWORK = {