Skip to content

Commit ecfce73

Browse files
committed
fix: cannot backup files under backup root
1 parent 97569fd commit ecfce73

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

executor/job_archive_init.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ func (a *jobArchiveExecutor) applyParam(ctx context.Context, param *entity.JobAr
3535
if src.Base[0] != '/' {
3636
src.Base = path.Join(a.exe.paths.Source, src.Base) + "/"
3737
}
38+
a.logger.Infof("walk source start, source_path= '%s'", src.RealPath())
3839

3940
sources, err = a.walk(ctx, src, sources)
4041
if err != nil {
4142
return err
4243
}
44+
a.logger.Infof("walk source finished, source_path= '%s' current_source_len= %d", src.RealPath(), len(sources))
4345
}
4446
sort.Slice(sources, func(i, j int) bool {
4547
return sources[i].Source.Compare(sources[j].Source) < 0
4648
})
49+
a.logger.Infof("walk source all finished, get %d sources", len(sources))
4750

4851
for idx, src := range sources {
4952
if idx > 0 && sources[idx-1].Source.Equal(src.Source) {
@@ -68,6 +71,7 @@ func (a *jobArchiveExecutor) walk(ctx context.Context, src *entity.Source, sourc
6871
mode := stat.Mode()
6972
if mode.IsRegular() {
7073
if stat.Name() == ".DS_Store" {
74+
a.logger.Infof("walk ignore file, reason= 'ignore .DS_Store' path= %s", path)
7175
return sources, nil
7276
}
7377
return append(sources, &entity.SourceState{
@@ -77,6 +81,7 @@ func (a *jobArchiveExecutor) walk(ctx context.Context, src *entity.Source, sourc
7781
}), nil
7882
}
7983
if mode&acp.UnexpectFileMode != 0 {
84+
a.logger.Infof("walk ignore file, reason= 'ignore unexpected file mode' path= %s mode= %O mask= %O", path, mode, acp.UnexpectFileMode)
8085
return sources, nil
8186
}
8287

frontend/src/pages/backup.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,22 @@ const useBackupTargetBrowser = () => {
160160
const sources = files
161161
.map((file) => {
162162
if (!file) {
163-
return undefined;
163+
console.log('create backup job, cannot get file')
164+
return;
164165
}
165166

166167
let path = file.id.trim();
167168
if (path.length === 0) {
169+
console.log('create backup job, file id is too short', file)
168170
return;
169171
}
170172
while (path.endsWith("/")) {
171173
path = path.slice(0, -1);
172174
}
173-
const splitIdx = path.lastIndexOf("/");
175+
176+
let splitIdx = path.lastIndexOf("/");
174177
if (splitIdx < 0) {
178+
splitIdx = -1
175179
return;
176180
}
177181

0 commit comments

Comments
 (0)