aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_sync.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-05-29 06:45:23 -0700
committerChris Lu <chris.lu@gmail.com>2021-05-29 06:45:27 -0700
commit2d7b4e5bb6dd62e14978ad38d882ad78320b1b4a (patch)
tree1681b02dbdfff18c7ff18cbaa4b816868dde2479 /weed/command/filer_sync.go
parentae185b997f80b48ef1155c76e4c1aeca89ab1937 (diff)
downloadseaweedfs-2d7b4e5bb6dd62e14978ad38d882ad78320b1b4a.tar.xz
seaweedfs-2d7b4e5bb6dd62e14978ad38d882ad78320b1b4a.zip
filer.backup: escape colon from path on windows
fix https://github.com/chrislusf/seaweedfs/issues/2084
Diffstat (limited to 'weed/command/filer_sync.go')
-rw-r--r--weed/command/filer_sync.go23
1 files changed, 13 insertions, 10 deletions
diff --git a/weed/command/filer_sync.go b/weed/command/filer_sync.go
index 0f34e5701..52fc0b477 100644
--- a/weed/command/filer_sync.go
+++ b/weed/command/filer_sync.go
@@ -359,16 +359,19 @@ func genProcessFunction(sourcePath string, targetPath string, dataSink sink.Repl
return processEventFn
}
-func buildKey(dataSink sink.ReplicationSink, message *filer_pb.EventNotification, targetPath string, sourceKey util.FullPath, sourcePath string) string {
+func buildKey(dataSink sink.ReplicationSink, message *filer_pb.EventNotification, targetPath string, sourceKey util.FullPath, sourcePath string) (key string) {
if !dataSink.IsIncremental() {
- return util.Join(targetPath, string(sourceKey)[len(sourcePath):])
- }
- var mTime int64
- if message.NewEntry != nil {
- mTime = message.NewEntry.Attributes.Mtime
- } else if message.OldEntry != nil {
- mTime = message.OldEntry.Attributes.Mtime
+ key = util.Join(targetPath, string(sourceKey)[len(sourcePath):])
+ } else {
+ var mTime int64
+ if message.NewEntry != nil {
+ mTime = message.NewEntry.Attributes.Mtime
+ } else if message.OldEntry != nil {
+ mTime = message.OldEntry.Attributes.Mtime
+ }
+ dateKey := time.Unix(mTime, 0).Format("2006-01-02")
+ key = util.Join(targetPath, dateKey, string(sourceKey)[len(sourcePath):])
}
- dateKey := time.Unix(mTime, 0).Format("2006-01-02")
- return util.Join(targetPath, dateKey, string(sourceKey)[len(sourcePath):])
+
+ return escapeKey(key)
}