Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use EncodingType=url for S3 list* requests to handle special chars #2026

Merged
merged 3 commits into from
Jan 25, 2021

Conversation

nl0
Copy link
Member

@nl0 nl0 commented Jan 22, 2021

Currently some weird key names (e.g. '\r\n') crash AWS SDK while performing list* operations, so we need to tell it explicitly to url-encode the keys (and then we need to manually decode them). However those keys still arent properly supported by the catalog -- they render with empty names and arent navigable (some quite involved refactoring required to fully handle this).

@nl0 nl0 requested review from sir-sigurd, fiskus and akarve January 22, 2021 14:13
Copy link
Member

@sir-sigurd sir-sigurd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In [3]: [x['Key'] for x in s3_client.list_objects_v2(Bucket='quilt-dev-null-2')['Contents']]
Out[3]: ['\x01', '\r\n', '    ', '&&&&', '+', '//', \\ы', 'ыыыы']

These keys are displayed like that:
image

It looks like decodeURIComponent() should be used instead, space is encoded as + and needs additional handling.

@nl0 nl0 requested a review from sir-sigurd January 25, 2021 04:40
@codecov-io
Copy link

codecov-io commented Jan 25, 2021

Codecov Report

Merging #2026 (87f624f) into master (b923a65) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2026      +/-   ##
==========================================
- Coverage   46.78%   46.78%   -0.01%     
==========================================
  Files         333      333              
  Lines       16728    16729       +1     
  Branches     2243     2220      -23     
==========================================
  Hits         7826     7826              
- Misses       7983     7984       +1     
  Partials      919      919              
Flag Coverage Δ
api-python 89.36% <ø> (ø)
catalog 7.28% <0.00%> (-0.01%) ⬇️
lambda 92.61% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
catalog/app/containers/Bucket/requests.js 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b923a65...87f624f. Read the comment docs.

@nl0 nl0 merged commit 53a608b into master Jan 25, 2021
@nl0 nl0 deleted the s3-handle-special-chars branch January 25, 2021 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants