mirror of
https://github.com/rclone/rclone.git
synced 2026-01-04 09:33:36 +00:00
operations: fix very long file names when using copy with --partial
Before this change we were using the wrong variable to read the filename length from. This meant that very long filenames were not being truncated as intended. This problem was spotted by Wang Zhiwei on the forum in a code review. See: https://forum.rclone.org/t/why-use-c-remoteforcopy-instead-of-c-remote-to-check-length-in-copy-operation/45099
This commit is contained in:
@@ -98,9 +98,9 @@ func (c *copy) checkPartial() (remoteForCopy string, inplace bool, err error) {
|
||||
// Avoid making the leaf name longer if it's already lengthy to avoid
|
||||
// trouble with file name length limits.
|
||||
suffix := "." + random.String(8) + c.ci.PartialSuffix
|
||||
base := path.Base(c.remoteForCopy)
|
||||
base := path.Base(remoteForCopy)
|
||||
if len(base) > 100 {
|
||||
remoteForCopy = TruncateString(c.remoteForCopy, len(c.remoteForCopy)-len(suffix)) + suffix
|
||||
remoteForCopy = TruncateString(remoteForCopy, len(remoteForCopy)-len(suffix)) + suffix
|
||||
} else {
|
||||
remoteForCopy += suffix
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user