File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -139,8 +139,11 @@ func (s *storage) move(from, to string) error {
139
139
s .files [to ].BaseFilename = filepath .Base (to )
140
140
s .children [to ] = s .children [from ]
141
141
142
- delete (s .children , from )
143
- delete (s .files , from )
142
+ defer func () {
143
+ delete (s .children , from )
144
+ delete (s .files , from )
145
+ delete (s .children [filepath .Dir (from )], filepath .Base (from ))
146
+ }()
144
147
145
148
return s .createParent (to , 0644 , s .files [to ])
146
149
}
Original file line number Diff line number Diff line change @@ -523,6 +523,10 @@ func (s *FilesystemSuite) TestRename(c *C) {
523
523
err := WriteFile (s .FS , "foo" , nil , 0644 )
524
524
c .Assert (err , IsNil )
525
525
526
+ files , err := s .FS .ReadDir ("" )
527
+ c .Assert (err , IsNil )
528
+ c .Assert (files , HasLen , 1 )
529
+
526
530
err = s .FS .Rename ("foo" , "bar" )
527
531
c .Assert (err , IsNil )
528
532
@@ -531,8 +535,12 @@ func (s *FilesystemSuite) TestRename(c *C) {
531
535
c .Assert (os .IsNotExist (err ), Equals , true )
532
536
533
537
bar , err := s .FS .Stat ("bar" )
538
+ c .Assert (err , IsNil )
534
539
c .Assert (bar , NotNil )
540
+
541
+ files , err = s .FS .ReadDir ("" )
535
542
c .Assert (err , IsNil )
543
+ c .Assert (files , HasLen , 1 )
536
544
}
537
545
538
546
func (s * FilesystemSuite ) TestRenameToDir (c * C ) {
You can’t perform that action at this time.
0 commit comments