From 3acece24383f983f0abad82f7f179e396f8aaf58 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Thu, 20 Oct 2022 11:41:46 +1100 Subject: [PATCH] Fix export zip paths when exporting from Windows (#3022) * Use correct zip path for export in windows * Fix recursive loop when importing tag hierarchy --- internal/manager/import.go | 2 +- internal/manager/task_export.go | 5 ++++- internal/manager/task_import.go | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/manager/import.go b/internal/manager/import.go index 0762096c2..f9fb57c8f 100644 --- a/internal/manager/import.go +++ b/internal/manager/import.go @@ -79,7 +79,7 @@ func performImport(ctx context.Context, i importer, duplicateBehaviour ImportDup if duplicateBehaviour == ImportDuplicateEnumFail { return fmt.Errorf("existing object with name '%s'", name) } else if duplicateBehaviour == ImportDuplicateEnumIgnore { - logger.Info("Skipping existing object") + logger.Infof("Skipping existing object %q", name) return nil } diff --git a/internal/manager/task_export.go b/internal/manager/task_export.go index d0f22ee0b..b968a5e76 100644 --- a/internal/manager/task_export.go +++ b/internal/manager/task_export.go @@ -261,7 +261,10 @@ func (t *ExportTask) zipWalkFunc(outDir string, z *zip.Writer) filepath.WalkFunc func (t *ExportTask) zipFile(fn, outDir string, z *zip.Writer) error { bn := filepath.Base(fn) - f, err := z.Create(filepath.Join(outDir, bn)) + p := filepath.Join(outDir, bn) + p = filepath.ToSlash(p) + + f, err := z.Create(p) if err != nil { return fmt.Errorf("error creating zip entry for %s: %s", fn, err.Error()) } diff --git a/internal/manager/task_import.go b/internal/manager/task_import.go index bd887b2e1..33d862c2e 100644 --- a/internal/manager/task_import.go +++ b/internal/manager/task_import.go @@ -581,7 +581,7 @@ func (t *ImportTask) ImportTag(ctx context.Context, tagJSON *jsonschema.Tag, pen if err := t.ImportTag(ctx, childTagJSON, pendingParent, fail, readerWriter); err != nil { var parentError tag.ParentTagNotExistError if errors.As(err, &parentError) { - pendingParent[parentError.MissingParent()] = append(pendingParent[parentError.MissingParent()], tagJSON) + pendingParent[parentError.MissingParent()] = append(pendingParent[parentError.MissingParent()], childTagJSON) continue }