Commit 25d9c70
Add ContentType detection and Tests for upload ExtraArgs (#35)
* enable server-side bucket to bucket copies
The 'copy_object' method permits setting different source and target buckets. When different, a server-side copy takes place between the buckets.
Appropriate ACLs must exist in AWS, but this is a quick method for copying keys between buckets within the same account and region.
Copying across regions and/or accounts is more complex, and is not enabled with this change.
* Allow settable extra_args for uploads and downloads
Allow setting upload and download `extra_args` values for the lifetime of the filesystem instance.
Ticket #32 has details
* Moved args to constructor and removed bucket copy
* load unquoted json if value is a string
* Expose `acl` and `cache-control` directly and via opener
* Small cleanup
* (bugfix) Only set if value exists
* Boto3 changed from `extra_args` to `ExtraArgs` at some point
This has been tested and works.
I uploaded a file to a private bucket, setting the max-age and ACL.
* Add ContentType Detection with fallback
The boto3 `upload_fileobj` never guesses the ContentType (unlike other Boto3 methods). So all files are stored as `binary/octet-stream`.
This can problematic when uploading images or audio, and expecting it to load inline.
`guess_type` is a lightweight guesser, that only looks at filenames. If this implementation fails to identify a type, it falls back to the defaults `binary/octet-stream`
* moved ContentType to ExtraArgs
The `client.upload_fileobj` method has `ContentType` in ExtraArgs.
* moved _upload_args to method to inject ContentType
* Add tests for upload ExtraArgs
* fix typo
* Fix TypeError if ContentType manually set
* fixes #381 parent 6d04cd1 commit 25d9c70
2 files changed
+23
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
353 | 354 | | |
354 | 355 | | |
355 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
356 | 364 | | |
357 | 365 | | |
358 | 366 | | |
| |||
535 | 543 | | |
536 | 544 | | |
537 | 545 | | |
538 | | - | |
| 546 | + | |
539 | 547 | | |
540 | 548 | | |
541 | 549 | | |
| |||
553 | 561 | | |
554 | 562 | | |
555 | 563 | | |
556 | | - | |
| 564 | + | |
557 | 565 | | |
558 | 566 | | |
559 | 567 | | |
| |||
602 | 610 | | |
603 | 611 | | |
604 | 612 | | |
605 | | - | |
| 613 | + | |
606 | 614 | | |
607 | 615 | | |
608 | 616 | | |
| |||
771 | 779 | | |
772 | 780 | | |
773 | 781 | | |
774 | | - | |
| 782 | + | |
775 | 783 | | |
776 | 784 | | |
777 | 785 | | |
| |||
789 | 797 | | |
790 | 798 | | |
791 | 799 | | |
792 | | - | |
| 800 | + | |
793 | 801 | | |
794 | 802 | | |
795 | 803 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
0 commit comments