"text/javascript; charset=utf-8" vs. "text/javascript" when uploading to Cloudflare R2

What is the problem you are having with rclone?

Hello,

I can successfully upload files to Cloudflare R2.

BUT:
JavaScript files get uploaded (and are being served from R2 again) as text/javascript; charset=utf-8

According to MDN, this is NOT correct, it should be text/javascript, without charset!

Is there a way to exclude information on charset when copying files to Cloudflare R2?

Run the command 'rclone version' and share the full output of the command.

$ rclone version
rclone v1.65.1
- os/version: debian 12.4 (64 bit)
- os/kernel: 5.15.133.1-microsoft-standard-WSL2 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.21.5
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Cloudflare R2

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone copy base.js r2:(...)/

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[r2]
type = s3
provider = Cloudflare
access_key_id = XXX
secret_access_key = XXX
region = auto
endpoint = https://XXX.r2.cloudflarestorage.com
acl = private

A log from the command that you were trying to run with the -vv flag

2024/01/16 13:01:20 DEBUG : rclone: Version "v1.65.1" starting with parameters ["rclone" "copy" "base.js" "r2:(...)/" "-vv"]
2024/01/16 13:01:20 DEBUG : Creating backend with remote "base.js"
2024/01/16 13:01:20 DEBUG : Using config file from "/home/(...)/.config/rclone/rclone.conf"
2024/01/16 13:01:20 DEBUG : fs cache: adding new entry for parent of "base.js", "/home/(...)"
2024/01/16 13:01:20 DEBUG : Creating backend with remote "r2:(...)/"
2024/01/16 13:01:20 DEBUG : Resolving service "s3" region "auto"
2024/01/16 13:01:20 DEBUG : fs cache: renaming cache item "r2:(...)/" to be canonical "r2:(...)"
2024/01/16 13:01:20 DEBUG : base.js: Need to transfer - File not found at Destination
2024/01/16 13:01:21 DEBUG : base.js: md5 = 6fa9ed426c95e78154faf04e757e4b8d OK
2024/01/16 13:01:21 INFO  : base.js: Copied (new)
2024/01/16 13:01:21 INFO  :
Transferred:      142.801 KiB / 142.801 KiB, 100%, 142.797 KiB/s, ETA 0s
Transferred:            1 / 1, 100%
Elapsed time:         1.2s

2024/01/16 13:01:21 DEBUG : 7 go routines active

Anybody ... ?

Any ideas ... ?

Also in your link to MDN.

Structure of MIME type:

Each type has its own set of possible subtypes. A MIME type always has both a type and a subtype, never just one or the other.

An optional parameter can be added to provide additional details:

type/subtype;parameter=value

For example, for any MIME type whose main type is text, you can add the optional charset parameter to specify the character set used for the characters in the data. If no charset is specified, the default is ASCII (US-ASCII) unless overridden by the user agent's settings. To specify a UTF-8 text file, the MIME type text/plain;charset=UTF-8 is used.

Can rclone change it or not I am not sure but text/javascript; charset=utf-8 is perfectly valid content-type IMO

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.