-
-
Notifications
You must be signed in to change notification settings - Fork 863
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 Issue #708: Save files with string content #911
Merged
jschneier
merged 8 commits into
jschneier:master
from
LincolnPuzey:fix_708_save_string_content
Sep 4, 2023
Merged
Fix Issue #708: Save files with string content #911
jschneier
merged 8 commits into
jschneier:master
from
LincolnPuzey:fix_708_save_string_content
Sep 4, 2023
Commits on Sep 4, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 587a42a - Browse repository at this point
Copy the full SHA 587a42aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 667a354 - Browse repository at this point
Copy the full SHA 667a354View commit details -
Add ReadBytesWrapper utility class for wrapping a file-like object.
This makes .read() always return bytes. If .read() returns a string, it will be encoded to bytes before being returned. The encoding to use can be specified, otherwise will use the .encoding property of the original file, otherwise will use utf-8.
Configuration menu - View commit details
-
Copy full SHA for c36c683 - Browse repository at this point
Copy the full SHA c36c683View commit details -
Fix issue jschneier#708: Make _save() wrap content in a ReadBytesWrap…
…per. This correctly handles file-like-objects that are open in text/string mode by converting to strings returned by read() to bytes, which is what upload_fileobj() requires. This is done before gzip compressing, so also removed force_bytes() call in _compress_content().
Configuration menu - View commit details
-
Copy full SHA for 5f742cd - Browse repository at this point
Copy the full SHA 5f742cdView commit details -
Add tests for saving both File/ContentFile with string/bytes.
Add these tests in a new test class that uses moto. Remove old test for saving ContentFile Move test for detecting content-type to this new class. Add some more tests around this. Fix tests that fail because settings.AWS_STORAGE_BUCKET_NAME is now defined. Fix tests that fail because content is always wrapped. Fix test for gzipped file since that now only takes bytes.
Configuration menu - View commit details
-
Copy full SHA for 79c25ad - Browse repository at this point
Copy the full SHA 79c25adView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f45042 - Browse repository at this point
Copy the full SHA 1f45042View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7e9f18a - Browse repository at this point
Copy the full SHA 7e9f18aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 577bb21 - Browse repository at this point
Copy the full SHA 577bb21View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.