From e3d7f29b03a78e9865a4c9e2edc19e9d94acc412 Mon Sep 17 00:00:00 2001 From: Peter Nemere Date: Tue, 26 Mar 2024 15:04:08 +1000 Subject: [PATCH] Fixing EM uploads where data zip is uploaded again, and 2 zips are found later in the process. Also print out path names of zips in the multiple subdir case --- .../internal/converters/pixlem/import.go | 3 ++- api/ws/handlers/scan.go | 17 ++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/api/dataimport/internal/converters/pixlem/import.go b/api/dataimport/internal/converters/pixlem/import.go index 480be3bd..17ddad4e 100644 --- a/api/dataimport/internal/converters/pixlem/import.go +++ b/api/dataimport/internal/converters/pixlem/import.go @@ -19,6 +19,7 @@ package pixlem import ( "errors" + "fmt" "os" "path/filepath" @@ -44,7 +45,7 @@ func (p PIXLEM) Import(importPath string, pseudoIntensityRangesPath string, data if entry.IsDir() { // If it's not the first one, we can't do this if len(subdir) > 0 { - return nil, "", errors.New("Found multiple subdirs, expected one in: " + importPath) + return nil, "", fmt.Errorf("Found multiple subdirs (\"%v\", \"%v\"), expected one in: \"%v\"", subdir, entry.Name(), importPath) } subdir = entry.Name() } diff --git a/api/ws/handlers/scan.go b/api/ws/handlers/scan.go index 2a7140ed..7845ba10 100644 --- a/api/ws/handlers/scan.go +++ b/api/ws/handlers/scan.go @@ -394,13 +394,16 @@ func HandleScanUploadReq(req *protos.ScanUploadReq, hctx wsHelpers.HandlerContex return nil, fmt.Errorf("Zip file missing RFS sub-directory") } - // Save the contents as a zip file in the uploads area - savePath := path.Join(s3PathStart, "data.zip") - err = fs.WriteObject(destBucket, savePath, zippedData) - if err != nil { - return nil, err - } - logger.Infof(" Wrote: s3://%v/%v", destBucket, savePath) + // NOTE: we just downloaded the zip from here, no point uploading it again! + /* + // Save the contents as a zip file in the uploads area + savePath := path.Join(s3PathStart, "data.zip") + err = fs.WriteObject(destBucket, savePath, zippedData) + if err != nil { + return nil, err + } + logger.Infof(" Wrote: s3://%v/%v", destBucket, savePath) + */ } else { // Expecting flat zip of MSA files count := 0