Skip to content

Commit 3e21a72

Browse files
authored
shade: Fix VFS test issues
1 parent fd439fa commit 3e21a72

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

backend/shade/shade.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,
311311
o := &Object{
312312
fs: f,
313313
remote: remote,
314+
mtime: srcObj.mtime,
315+
size: srcObj.size,
314316
}
315317
fromFullPath := path.Join(src.Fs().Root(), srcObj.remote)
316318
toFullPath := path.Join(f.root, remote)
@@ -367,7 +369,18 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string
367369
return fs.ErrorDirExists
368370
}
369371

370-
err := f.ensureParentDirectories(ctx, dstRemote)
372+
fullPathSrc := f.buildFullPath(srcRemote)
373+
fullPathSrcUnencoded, err := url.QueryUnescape(fullPathSrc)
374+
if err != nil {
375+
return err
376+
}
377+
378+
fullPathDstUnencoded, err := url.QueryUnescape(fullPath)
379+
if err != nil {
380+
return err
381+
}
382+
383+
err = f.ensureParentDirectories(ctx, dstRemote)
371384
if err != nil {
372385
return err
373386
}
@@ -378,6 +391,15 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string
378391
}
379392

380393
_, err = f.Move(ctx, o, dstRemote)
394+
395+
if err == nil {
396+
397+
f.createdDirMu.Lock()
398+
f.createdDirs[fullPathSrcUnencoded] = false
399+
f.createdDirs[fullPathDstUnencoded] = true
400+
f.createdDirMu.Unlock()
401+
}
402+
381403
return err
382404
}
383405

0 commit comments

Comments
 (0)