Closed allynt closed 4 years ago
So this is a feature not a bug. The ampersand character is used as the separator between different query parameters, so obviously escaping it is not very straightforward. By the time we get to the ProxyView
it's already gone.
I can instead, escape it before it gets to the view. For example, in THERMCERT the LayersView
builds a URL to send to the ProxyView
. The key
value can be escaped while it's being generated:
from urllib import parse
client = DataClient()
objs = client.get_objects(key, metadata_only=True)
for obj in objs:
obj_key = parse.quote(obj.metadata["key"])
obj_url = f"/api/proxy/s3?key={obj_key}"
Checklist
IssueID #123 - Update dependencies for front-end:
. The important bit is the startIssueID #123
, this will create a reference in the issue, to the commit.Is your feature request related to a problem? Please describe
The API can proxy GET requests to S3 Buckets. However, if the object names in the bucket being requested have special characters in them (such as "&") they must first be escaped.
Describe the solution you'd like
Escape the key parameter prior to calling
client.get_object(key)
inProxyS3View
(indjango-astrosat-core
).Describe alternatives you've considered
Just rename the objects to not have characters that require escaping.