From 9bfcb6e673322c5c3b367ee7c1990b9fce25400c Mon Sep 17 00:00:00 2001 From: consolethinks Date: Fri, 9 Aug 2024 17:37:40 +0200 Subject: [PATCH] datasetIngestor: fix the check for "allowexistingsource is set" --- cmd/commands/datasetIngestor.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/commands/datasetIngestor.go b/cmd/commands/datasetIngestor.go index af89725..c01ea8b 100644 --- a/cmd/commands/datasetIngestor.go +++ b/cmd/commands/datasetIngestor.go @@ -215,13 +215,15 @@ For Windows you need instead to specify -user username:password on the command l color.Set(color.FgYellow) if len(foundList) > 0 { fmt.Println("Warning! The following datasets have been found with the same sourceFolder: ") + } else { + log.Println("Finished testing for existing source folders.") } for _, element := range foundList { fmt.Printf(" - PID: \"%s\", sourceFolder: \"%s\"\n", element.Pid, element.SourceFolder) } color.Unset() if !allowExistingSourceFolder && len(foundList) > 0 { - if cmd.Flags().Changed("allowexistingsource") { + if !cmd.Flags().Changed("allowexistingsource") { log.Printf("Do you want to ingest the corresponding new datasets nevertheless (y/N) ? ") scanner.Scan() archiveAgain := scanner.Text() @@ -491,15 +493,15 @@ func createLocalSymlinkCallbackForFileLister(skipSymlinks *string, skippedLinks keep := true pointee, _ := os.Readlink(symlinkPath) // just pass the file name if !filepath.IsAbs(pointee) { - dir, err := filepath.Abs(filepath.Dir(symlinkPath)) + symlinkAbs, err := filepath.Abs(filepath.Dir(symlinkPath)) if err != nil { return false, err } // log.Printf(" CWD path pointee :%v %v %v", dir, filepath.Dir(path), pointee) - pabs := filepath.Join(dir, filepath.Dir(symlinkPath), pointee) - pointee, err = filepath.EvalSymlinks(pabs) + pointeeAbs := filepath.Join(symlinkAbs, pointee) + pointee, err = filepath.EvalSymlinks(pointeeAbs) if err != nil { - log.Printf("Could not follow symlink for file:%v %v", pabs, err) + log.Printf("Could not follow symlink for file:%v %v", pointeeAbs, err) keep = false log.Printf("keep variable set to %v", keep) }