From 8ae04b41b016d06ca8908bf2d861c3fe300fdeab Mon Sep 17 00:00:00 2001 From: poornas Date: Wed, 3 Apr 2019 08:15:17 -0700 Subject: [PATCH] mirror: fix 0 byte files not getting mirrored (#2739) Fixes: #2737 --- cmd/mirror-main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/mirror-main.go b/cmd/mirror-main.go index 0494424b..16c576b0 100644 --- a/cmd/mirror-main.go +++ b/cmd/mirror-main.go @@ -353,7 +353,9 @@ func (mj *mirrorJob) watchMirror(ctx context.Context, cancelMirror context.Cance } sourceURL := newClientURL(eventPath) - aliasedPath := strings.Replace(eventPath, sourceURLFull, mj.sourceURL, -1) + // trim trailing slash from source url + sourceURLStr := strings.TrimSuffix(sourceURLFull, string(sourceURL.Separator)) + aliasedPath := strings.Replace(eventPath, sourceURLStr, mj.sourceURL, -1) // build target path, it is the relative of the eventPath with the sourceUrl // joined to the targetURL.