1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

copyurl: Add option to honor the HTTP header filename directive.

Implemented --header-filename for use with copyurl.

For specifically setting preferred download filenames for HTTP requests, RFC 6226
specifies a 'filename' directive, available within 'Content-Disposition'
header. We can handle with 'mime.ParseMediaType'.

See below for details:
https://httpwg.org/specs/rfc6266.html#disposition.parameter.filename
https://httpwg.org/specs/rfc6266.html#advice.generating

Co-authored-by: buengese <buengese@protonmail.com>
This commit is contained in:
J-P Treen
2021-07-28 17:05:21 +01:00
committed by Nick Craig-Wood
parent f2a15a174f
commit 8b8802a078
4 changed files with 36 additions and 21 deletions

View File

@@ -274,8 +274,9 @@ func rcSingleCommand(ctx context.Context, in rc.Params, name string, noRemote bo
}
autoFilename, _ := in.GetBool("autoFilename")
noClobber, _ := in.GetBool("noClobber")
headerFilename, _ := in.GetBool("headerFilename")
_, err = CopyURL(ctx, f, remote, url, autoFilename, noClobber)
_, err = CopyURL(ctx, f, remote, url, autoFilename, headerFilename, noClobber)
return nil, err
case "uploadfile":