Filename from header not recognized when disposition type is missing
The associated forum post URL from https://forum.rclone.org
none
What is the problem you are having with rclone?
~Filenames surrounded by quotes in the Content-Disposition header are not recognized,~
When the Content-Disposition header is missing the disposition type, such as attachment or inline, the filename is not recognized by the mime package.
Both curl -OJ and wget --content-disposition grabs the filename from headers without a disposition type. Perhaps rclone could just be smart about it too, even though it may or may not go against spec?
/data # curl -I 'http://172.20.0.14:8080/data?ih=08ada5a7a6183aae1e09d831df6748d566095a10&path=Sintel.mp4'
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Disposition: filename="Sintel.mp4"
Content-Length: 129241752
Content-Type: video/mp4
Date: Sun, 07 Dec 2025 21:45:06 GMT
~and rclone doesn't seem to handle them either~
https://github.com/rclone/rclone/blob/847734d421d219f1b12b144fcb0d08a6556e1485/fs/operations/operations.go#L1862-L1878
What is your rclone version (output from rclone version)
/data # rclone --version
rclone v1.71.0
- os/version: alpine 3.22.1 (64 bit)
- os/kernel: 6.1.0-34-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.25.1
- go/linking: static
- go/tags: none
/data # ./rclone-v1.72.0-linux-amd64/rclone --version
rclone v1.72.0
- os/version: alpine 3.22.1 (64 bit)
- os/kernel: 6.1.0-34-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.25.4
- go/linking: static
- go/tags: none
/data # ./rclone-v1.73.0-beta.9336.847734d42-linux-amd64/rclone --version
rclone v1.73.0-beta.9336.847734d42
- os/version: alpine 3.22.1 (64 bit)
- os/kernel: 6.1.0-34-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.25.5
- go/linking: static
- go/tags: none
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
Alpine 3.22.1, 64 bit, the rclone docker image
Which cloud storage system are you using? (e.g. Google Drive)
unrelated
The command you were trying to run (e.g. rclone copy /tmp remote:tmp)
rclone -vv copyurl -a --header-filename 'http://172.20.0.14:8080/data?ih=08ada5a7a6183aae1e09d831df6748d566095a10&path=Sintel.mp4' --webdav-url http://172.20.0.6:9898 :webdav:/test
./rclone-v1.72.0-linux-amd64/rclone -vv copyurl -a --header-filename 'http://172.20.0.14:8080/data?ih=08ada5a7a6183aae1e09d831df6748d566095a10&path=Sintel.mp4' --webdav-url http://172.20.0.6:9898 :webdav:/test
./rclone-v1.73.0-beta.9336.847734d42-linux-amd64/rclone -vv copyurl -a --header-filename 'http://172.20.0.14:8080/data?ih=08ada5a7a6183aae1e09d831df6748d566095a10&path=Sintel.mp4' --webdav-url http://172.20.0.6:9898 :webdav:/test
A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)
/data # rclone -vv copyurl -a --header-filename 'http://172.20.0.14:8080/data?ih=08ada5a7a6183aae1e09d831df6748d566095a10&path=Sintel.mp4' --webdav-url http://172.20.0.6:9898 :webdav:/test
2025/12/07 21:43:57 DEBUG : rclone: Version "v1.71.0" starting with parameters ["rclone" "-vv" "copyurl" "-a" "--header-filename" "http://172.20.0.14:8080/data?ih=08ada5a7a6183aae1e09d831df6748d566095a10&path=Sintel.mp4" "--webdav-url" "http://172.20.0.6:9898" ":webdav:/test"]
2025/12/07 21:43:57 DEBUG : Creating backend with remote ":webdav:/test"
2025/12/07 21:43:57 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2025/12/07 21:43:57 DEBUG : :webdav: detected overridden config - adding "{iNuAj}" suffix to name
2025/12/07 21:43:57 DEBUG : found headers:
2025/12/07 21:43:57 DEBUG : fs cache: renaming cache item ":webdav:/test" to be canonical ":webdav{iNuAj}:test"
2025/12/07 21:43:57 ERROR : Attempt 1/3 failed with 1 errors and: CopyURL failed: filename not found in the Content-Disposition header
2025/12/07 21:43:57 DEBUG : fs cache: switching user supplied name ":webdav:/test" for canonical name ":webdav{iNuAj}:test"
2025/12/07 21:43:57 ERROR : Attempt 2/3 failed with 1 errors and: CopyURL failed: filename not found in the Content-Disposition header
2025/12/07 21:43:57 DEBUG : fs cache: switching user supplied name ":webdav:/test" for canonical name ":webdav{iNuAj}:test"
2025/12/07 21:43:57 ERROR : Attempt 3/3 failed with 1 errors and: CopyURL failed: filename not found in the Content-Disposition header
2025/12/07 21:43:57 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Errors: 1 (retrying may help)
Elapsed time: 0.0s
2025/12/07 21:43:57 DEBUG : 6 go routines active
2025/12/07 21:43:57 NOTICE: Failed to copyurl: CopyURL failed: filename not found in the Content-Disposition header
/data # ./rclone-v1.72.0-linux-amd64/rclone -vv copyurl -a --header-filename 'http://172.20.0.14:8080/data?ih=08ada5a7a6183aae1e09d831df6748d566095a10&path=Sintel.mp4' --webdav-url http://172.20.0.6:9898 :webdav:/test
2025/12/07 21:44:22 DEBUG : rclone: Version "v1.72.0" starting with parameters ["./rclone-v1.72.0-linux-amd64/rclone" "-vv" "copyurl" "-a" "--header-filename" "http://172.20.0.14:8080/data?ih=08ada5a7a6183aae1e09d831df6748d566095a10&path=Sintel.mp4" "--webdav-url" "http://172.20.0.6:9898" ":webdav:/test"]
2025/12/07 21:44:22 DEBUG : Creating backend with remote ":webdav:/test"
2025/12/07 21:44:22 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2025/12/07 21:44:22 DEBUG : :webdav: detected overridden config - adding "{iNuAj}" suffix to name
2025/12/07 21:44:22 DEBUG : found headers:
2025/12/07 21:44:22 DEBUG : fs cache: renaming cache item ":webdav:/test" to be canonical ":webdav{iNuAj}:test"
2025/12/07 21:44:22 ERROR : Attempt 1/3 failed with 1 errors and: CopyURL failed: filename not found in the Content-Disposition header
2025/12/07 21:44:22 DEBUG : fs cache: switching user supplied name ":webdav:/test" for canonical name ":webdav{iNuAj}:test"
2025/12/07 21:44:22 ERROR : Attempt 2/3 failed with 1 errors and: CopyURL failed: filename not found in the Content-Disposition header
2025/12/07 21:44:22 DEBUG : fs cache: switching user supplied name ":webdav:/test" for canonical name ":webdav{iNuAj}:test"
2025/12/07 21:44:22 ERROR : Attempt 3/3 failed with 1 errors and: CopyURL failed: filename not found in the Content-Disposition header
2025/12/07 21:44:22 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Errors: 1 (retrying may help)
Elapsed time: 0.0s
2025/12/07 21:44:22 DEBUG : 7 go routines active
2025/12/07 21:44:22 NOTICE: Failed to copyurl: CopyURL failed: filename not found in the Content-Disposition header
/data # ./rclone-v1.73.0-beta.9336.847734d42-linux-amd64/rclone -vv copyurl -a --header-filename 'http://172.20.0.14:8080/data?ih=08ada5a7a6183aae1e09d831df6748d566095a10&path=Sintel.mp4' --webdav-url http://172.20.0.6:9898 :webdav:/test
2025/12/07 22:29:43 DEBUG : rclone: Version "v1.73.0-beta.9336.847734d42" starting with parameters ["./rclone-v1.73.0-beta.9336.847734d42-linux-amd64/rclone" "-vv" "copyurl" "-a" "--header-filename" "http://172.20.0.14:8080/data?ih=08ada5a7a6183aae1e09d831df6748d566095a10&path=Sintel.mp4" "--webdav-url" "http://172.20.0.6:9898" ":webdav:/test"]
2025/12/07 22:29:43 DEBUG : Creating backend with remote ":webdav:/test"
2025/12/07 22:29:43 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2025/12/07 22:29:43 DEBUG : :webdav: detected overridden config - adding "{iNuAj}" suffix to name
2025/12/07 22:29:43 DEBUG : found headers:
2025/12/07 22:29:45 DEBUG : fs cache: renaming cache item ":webdav:/test" to be canonical ":webdav{iNuAj}:test"
2025/12/07 22:29:45 ERROR : Attempt 1/3 failed with 1 errors and: CopyURL failed: filename not found in the Content-Disposition header
2025/12/07 22:29:45 DEBUG : fs cache: switching user supplied name ":webdav:/test" for canonical name ":webdav{iNuAj}:test"
2025/12/07 22:29:45 ERROR : Attempt 2/3 failed with 1 errors and: CopyURL failed: filename not found in the Content-Disposition header
2025/12/07 22:29:45 DEBUG : fs cache: switching user supplied name ":webdav:/test" for canonical name ":webdav{iNuAj}:test"
2025/12/07 22:29:45 ERROR : Attempt 3/3 failed with 1 errors and: CopyURL failed: filename not found in the Content-Disposition header
2025/12/07 22:29:45 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Errors: 1 (retrying may help)
Elapsed time: 0.0s
2025/12/07 22:29:45 DEBUG : 6 go routines active
2025/12/07 22:29:45 NOTICE: Failed to copyurl: CopyURL failed: filename not found in the Content-Disposition header
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Oh! After some sleep I now realize this is an issue with the mime package,
https://github.com/rclone/rclone/blob/847734d421d219f1b12b144fcb0d08a6556e1485/fs/operations/operations.go#L1864
or rather, the header itself (one could argue).
As I understand it, Content-Disposition: filename="Sintel.mp4" is not in strict accordance with RFC 6266. However, in section 4.2 of the same spec it says:
Unknown or unhandled disposition types SHOULD be handled by recipients the same way as "attachment" (see also [RFC2183], Section 2.8).
and in section 2.8 of RFC 2183:
Unrecognized parameters should be ignored. Unrecognized disposition types should be treated as `attachment'. The choice of `attachment' for unrecognized types is made because a sender who goes to the trouble of producing a Content-Disposition header with a new disposition type is more likely aiming for something more elaborate than inline presentation.
Unless noted otherwise in the definition of a parameter, Content- Disposition parameters are valid for all dispositions. (In contrast to MIME content-type parameters, which are defined on a per-content- type basis.) Thus, for example, the `filename' parameter still means the name of the file to which the part should be written, even if the disposition itself is unrecognized.
I'm not very well versed in these things (at all), but if I understand this right, the statement implies that the mime package is behaving correctly, while it's up to rclone to treat unrecognized dispositions as an "attachment" and thus not rely entirely on mime.
Although, I could misinterpret the word "unhandled" or "unrecognized". It could also mean that
Content-Disposition: filename="Sintel.mp4"
is invalid and ignored, while
Content-Disposition: some-unknown-type; filename="Sintel.mp4"
is not. That's how mime does it.
I'm not sure, but then English is not my native language either. In any case, both curl -OJ and wget --content-disposition grabs the filename from headers without a disposition type. Perhaps rclone could just be smart about it too, even though it may or may not go against spec?