Revert "Storage/S3: Work around nginx url encoding issue"

This reverts commit 4a861b0576ed0c906418fba5b0ae8fba862fac65.
This commit is contained in:
Adrian Moennich 2022-02-16 15:03:32 +01:00
parent 4a861b0576
commit dcfde30da0
3 changed files with 2 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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