1
mirror of https://github.com/rclone/rclone synced 2024-12-10 22:33:56 +01:00

backend http: Adding no-escape flag for option to not escape URL metacharacters in path names - fixes issue #7637

This commit is contained in:
Kyle Reynolds 2024-04-17 15:45:12 -06:00 committed by Nick Craig-Wood
parent 8977655869
commit d36bc8833c

View File

@ -89,6 +89,10 @@ that directory listings are much quicker, but rclone won't have the times or
sizes of any files, and some files that don't exist may be in the listing.`, sizes of any files, and some files that don't exist may be in the listing.`,
Default: false, Default: false,
Advanced: true, Advanced: true,
}, {
Name: "no_escape",
Help: "Do not escape URL metacharacters in path names.",
Default: false,
}}, }},
} }
fs.Register(fsi) fs.Register(fsi)
@ -100,6 +104,7 @@ type Options struct {
NoSlash bool `config:"no_slash"` NoSlash bool `config:"no_slash"`
NoHead bool `config:"no_head"` NoHead bool `config:"no_head"`
Headers fs.CommaSepList `config:"headers"` Headers fs.CommaSepList `config:"headers"`
NoEscape bool `config:"no_escape"`
} }
// Fs stores the interface to the remote HTTP files // Fs stores the interface to the remote HTTP files
@ -326,6 +331,11 @@ func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
// Join's the remote onto the base URL // Join's the remote onto the base URL
func (f *Fs) url(remote string) string { func (f *Fs) url(remote string) string {
if f.opt.NoEscape {
// Directly concatenate without escaping, no_escape behavior
return f.endpointURL + remote
}
// Default behavior
return f.endpointURL + rest.URLPathEscape(remote) return f.endpointURL + rest.URLPathEscape(remote)
} }