From 51f88fe33e96437e0c2ce0644c8aaf59ea0fc9a1 Mon Sep 17 00:00:00 2001 From: Samuel N Cui Date: Sat, 21 Oct 2023 13:52:43 +0800 Subject: [PATCH] fix: backup file under root dir --- executor/job_archive_init.go | 2 +- frontend/src/pages/backup.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/executor/job_archive_init.go b/executor/job_archive_init.go index 4ee1981..70db804 100644 --- a/executor/job_archive_init.go +++ b/executor/job_archive_init.go @@ -32,7 +32,7 @@ func (a *jobArchiveExecutor) applyParam(ctx context.Context, param *entity.JobAr sources := make([]*entity.SourceState, 0, len(param.Sources)*8) for _, src := range param.Sources { src.Base = strings.TrimSpace(src.Base) - if src.Base[0] != '/' { + if src.Base == "" || src.Base[0] != '/' { src.Base = path.Join(a.exe.paths.Source, src.Base) + "/" } a.logger.Infof("walk source start, source_path= '%s'", src.RealPath()) diff --git a/frontend/src/pages/backup.tsx b/frontend/src/pages/backup.tsx index 4117688..dafd5a8 100644 --- a/frontend/src/pages/backup.tsx +++ b/frontend/src/pages/backup.tsx @@ -176,7 +176,6 @@ const useBackupTargetBrowser = () => { let splitIdx = path.lastIndexOf("/"); if (splitIdx < 0) { splitIdx = -1 - return; } return { base: path.slice(0, splitIdx + 1), path: [path.slice(splitIdx + 1)] } as Source;