From f9b8f5bbfc831233cd8beafbe175fa71b50434db Mon Sep 17 00:00:00 2001 From: Balasankar 'Balu' C Date: Sat, 13 Sep 2025 18:48:05 +0530 Subject: [PATCH] Fix parameters passed for GCS URL generation When GCP support was originally added, the parameters were `response_disposition` and `content_type`. When it was refactored in https://github.com/pulp/pulpcore/pull/4251, the headers were GCS were mistakenly changed and expanded. These parameters get used by `generate_signed_url` method defined in https://github.com/googleapis/python-storage/blob/a8109e0/google/cloud/storage/blob.py#L463, through https://github.com/jschneier/django-storages/blob/758ad6f/storages/backends/gcloud.py#L350 This PR ensures only the supported parameters are passed to that function call. closes #6917 Signed-off-by: Balasankar 'Balu' C --- CHANGES/6917.bugfix | 1 + pulpcore/constants.py | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) create mode 100644 CHANGES/6917.bugfix diff --git a/CHANGES/6917.bugfix b/CHANGES/6917.bugfix new file mode 100644 index 00000000000..a2f2b220203 --- /dev/null +++ b/CHANGES/6917.bugfix @@ -0,0 +1 @@ +Fixed generation of signed URLs when using GCS as the storage backend. diff --git a/pulpcore/constants.py b/pulpcore/constants.py index efa85d4a708..fb128573b97 100644 --- a/pulpcore/constants.py +++ b/pulpcore/constants.py @@ -101,14 +101,11 @@ "Content-Language": "content_language", "Content-Encoding": "content_encoding", } -# https://gcloud.readthedocs.io/en/latest/storage-blobs.html +# https://gcloud.readthedocs.io/en/latest/storage-blobs.html#google.cloud.storage.blob.Blob.generate_signed_url # response-headers Google Cloud Storage respects, and what they map to in a GCS object GCS_RESPONSE_HEADER_MAP = { - "Content-Disposition": "content_disposition", - "Content-Type": "content_type", - "Cache-Control": "cache_control", - "Content-Language": "content_language", - "Content-Encoding": "content_encoding", + "Content-Disposition": "response_disposition", + "Content-Type": "response_type", } # Storage-type mapped to storage-response-map