-
Notifications
You must be signed in to change notification settings - Fork 99
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
Enable attachment of binary files as charm resources #1147
base: main
Are you sure you want to change the base?
Conversation
1 similar comment
@@ -2078,7 +2078,7 @@ def _upload(self, data, path, app_name, res_name, res_type, pending_id): | |||
|
|||
headers['Content-Type'] = 'application/octet-stream' | |||
headers['Content-Length'] = len(data) | |||
headers['Content-Sha384'] = hashlib.sha384(bytes(data, 'utf-8')).hexdigest() | |||
headers['Content-Sha384'] = hashlib.sha384(data).hexdigest() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This effectively changes the argument type from str
to bytes
.
There's one more call site at line 2141 that would have to be updated to match.
P.S. please add an explicit type hint on the argument.
@nrobinaubertin this PR needs some kind of test. ideally an integration test, or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing to more than dima.
- Please add a test that would trigger the bug if not fixed
- take care of all call site of
_upload
to ensuredata
type consistency.
Niels, I see that the PR where you needed this was closed. Do you have the bandwidth to update this PR? If not, I can maybe create an issue based on the PR and eventually someone else can pick this up. What you're fixing is basically a bug, as binary resources should be supported. |
This PR needs to be rebased since #1186 has been merged. |
Description
This enables the attachment of binary files as charm resources.
Fixes: #1000