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

Fix case sensitivity in minio metadata #590

Merged
merged 1 commit into from
Dec 7, 2020

Conversation

hardbyte
Copy link
Collaborator

@hardbyte hardbyte commented Dec 4, 2020

Field names in HTTP headers are case-insensitive, some networks decide that means that can normalize the headers however they like, presumably to keep things interesting.

On one such network the backend errors with the following:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/celery/app/trace.py", line 385, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/var/www/entityservice/tasks/base_task.py", line 87, in __call__
    return super(TracedTask, self).__call__(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/celery/app/trace.py", line 650, in __protected_call__
    return self.run(*args, **kwargs)
  File "/var/www/entityservice/tasks/encoding_uploading.py", line 72, in pull_external_data
    count = int(stat.metadata['X-Amz-Meta-Hash-Count'])
KeyError: 'X-Amz-Meta-Hash-Count'

Minio's stat.metadata is a dict of custom HTTP headers used to transfer metadata from the anonlink-client to the server via the object store. This small change ensures that the server will get the correct values regardless of the case of the header.

Field names in HTTP headers are case-insensitive, some networks decide that means that can normalize them however they like.

Minio's stat.metadata is a dict of custom HTTP headers. This
small change ensures that queries will get the header regardless
of the case.
@hardbyte hardbyte mentioned this pull request Dec 6, 2020
Copy link
Contributor

@joyceyuu joyceyuu left a comment

Choose a reason for hiding this comment

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

Look good to me!

@hardbyte hardbyte merged commit bb87b02 into develop Dec 7, 2020
@hardbyte hardbyte deleted the fix-case-sensitivity-for-minio-metadata branch December 7, 2020 00:14
@hardbyte hardbyte added this to the Entity Service v1.14 milestone Feb 23, 2021
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.

None yet

2 participants