Explorar o código

Fixed trash restore buig

Toby Chui %!s(int64=3) %!d(string=hai) anos
pai
achega
3d9b01fae1
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      file_system.go

+ 3 - 1
file_system.go

@@ -1015,7 +1015,9 @@ func system_fs_restoreFile(w http.ResponseWriter, r *http.Request) {
 	}
 
 	//OK to proceed.
-	targetPath := filepath.ToSlash(filepath.Join(filepath.Dir(filepath.Dir(realpath)), strings.TrimSuffix(filepath.Base(realpath), filepath.Ext(filepath.Base(realpath)))))
+	originalFilename := strings.TrimSuffix(filepath.Base(realpath), filepath.Ext(filepath.Base(realpath)))
+	restoreFolderRoot := filepath.Dir(filepath.Dir(filepath.Dir(realpath)))
+	targetPath := filepath.ToSlash(filepath.Join(restoreFolderRoot, originalFilename))
 	//log.Println(targetPath)
 	os.Rename(realpath, targetPath)