I have been working on porting some gsutil
based scripts to use rclone
and have discovered a difference in behavior with .gz
extension local source files being copied to a bucket.
Here is an example of the different behaviors given a test file like test.js.gz
which is gzipped via gzip test.js
Copying the file with gsutil:
$ gsutil cp test.js.gz gs://remote
$ gsutil ls -L gs://remote/test.js.gz | grep -i content-type
Content-Type: application/javascript
Copying the file with rclone:
$ rclone copy test.js.gz :gcs:remote
$ gsutil ls -L gs://remote/test.js.gz | grep -i content-type
Content-Type: application/gzip
gcloud storage ...
also maintains the same behavior.
So they appear to set the content type based on the local file name mime without the .gz
suffix.
I was hunting around for this behavior in rclone docs but could not find anything existing that looked applicable, so felt more like a new feature discussion.
Assuming I didn't miss any pre-existing setting that enabled this, it would be very convenient for this edge case to have a rclone flag like: --gcs-content-type-without-gz
that would preserve the gsutil behavior.
My versions of tools for reference:
- rclone v1.53.3-DEV (and tested with v1.64.0)
- gsutil 5.25