Bugfix - upload detailed summary target and source mismatch
@@ -88,9 +88,10 @@ func PrintSummaryReport(success, failed int, reader *content.ContentReader, rtUr
log.Output(basicSummary)
defer log.Output("}")
for file := new(serviceutils.FileInfo); reader.NextRecord(file) == nil; file = new(serviceutils.FileInfo) {
+ source, target := getSourceAndTarget(*file, rtUrl)
record := detailedSummaryRecord{
- Source: rtUrl + file.ArtifactoryPath,
- Target: file.LocalPath,
+ Source: source,
+ Target: target,
}
writer.Write(record)
}
@@ -98,6 +99,19 @@ func PrintSummaryReport(success, failed int, reader *content.ContentReader, rtUr
return summaryPrintError(mErr, originalErr)
}
+func getSourceAndTarget(file serviceutils.FileInfo, rtUrl string) (source, target string) {
+ if rtUrl != "" {
+ // Download
+ source = rtUrl + file.ArtifactoryPath
+ target = file.LocalPath
+ } else {
+ // Upload
+ source = file.LocalPath
+ target = file.ArtifactoryPath
+ }
+ return
+}
+
func CreateSummaryReportString(success, failed int, err error) (string, error) {
summaryReport := summary.New(err)
summaryReport.Totals.Success = success
