diff --git a/storage_s3/README.md b/storage_s3/README.md index a7ac6f3..f38f970 100644 --- a/storage_s3/README.md +++ b/storage_s3/README.md @@ -15,12 +15,6 @@ to local storage (but it would of course be possible to write a script for this) ## Changelog -### 3.1.1 - -- Revert the fix from the previous version and replace it with one that's more reliable as - the problematic behavior seems to be caused by an nginx bug and the previous fix caused - failures in other cases - ### 3.1 - Fix "invalid signature" S3 error in some cases when using `proxy=nginx` for downloads diff --git a/storage_s3/indico_storage_s3/storage.py b/storage_s3/indico_storage_s3/storage.py index 1e80d99..be93de6 100644 --- a/storage_s3/indico_storage_s3/storage.py +++ b/storage_s3/indico_storage_s3/storage.py @@ -19,7 +19,6 @@ import boto3 from boto3.s3.transfer import TransferConfig from botocore.config import Config from botocore.exceptions import ClientError -from flask import request from werkzeug.datastructures import Headers from werkzeug.urls import url_quote from werkzeug.utils import cached_property, redirect @@ -157,10 +156,7 @@ class S3StorageBase(Storage): if self.proxy_downloads == ProxyDownloadsMode.nginx: # nginx can proxy the request to S3 to avoid exposing the redirect and # bucket URL to the end user (since it is quite ugly and temporary) - nginx_url = url.replace('://', '/', 1) - if '%' not in request.base_url: - nginx_url = url_quote(nginx_url) - response.headers['X-Accel-Redirect'] = f'/.xsf/s3/{nginx_url}' + response.headers['X-Accel-Redirect'] = '/.xsf/s3/' + url_quote(url.replace('://', '/', 1)) return response except Exception as exc: raise StorageError(f'Could not send file "{file_id}": {exc}') from exc diff --git a/storage_s3/setup.cfg b/storage_s3/setup.cfg index 94012b4..0fbc8e9 100644 --- a/storage_s3/setup.cfg +++ b/storage_s3/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = indico-plugin-storage-s3 -version = 3.1.1 +version = 3.1 description = S3 storage backend for Indico long_description = file: README.md long_description_content_type = text/markdown; charset=UTF-8; variant=GFM