|
@@ -1348,6 +1348,10 @@ func system_fs_handleWebSocketOpr(w http.ResponseWriter, r *http.Request) {
|
|
|
c.Close()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ //Remove the cache for the original file
|
|
|
+ metadata.RemoveCache(rsrcFile)
|
|
|
+
|
|
|
} else if operation == "copy" {
|
|
|
err := fs.FileCopy(rsrcFile, rdestFile, existsOpr, func(progress int, currentFile string) {
|
|
|
//Multply child progress to parent progress
|
|
@@ -1538,6 +1542,9 @@ func system_fs_handleOpr(w http.ResponseWriter, r *http.Request) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ //Remove the cache for the original file
|
|
|
+ metadata.RemoveCache(rsrcFile)
|
|
|
+
|
|
|
} else if operation == "move" {
|
|
|
//File move operation. Check if the source file / dir and target directory exists
|
|
|
/*
|
|
@@ -1614,6 +1621,8 @@ func system_fs_handleOpr(w http.ResponseWriter, r *http.Request) {
|
|
|
//Set user to own the new file
|
|
|
userinfo.SetOwnerOfFile(filepath.ToSlash(filepath.Clean(rdestFile)) + "/" + filepath.Base(rsrcFile))
|
|
|
|
|
|
+ //Remove cache for the original file
|
|
|
+ metadata.RemoveCache(rsrcFile)
|
|
|
} else if operation == "copy" {
|
|
|
//Copy file. See move example and change 'opr' to 'copy'
|
|
|
if !fileExists(rsrcFile) {
|
|
@@ -1663,17 +1672,6 @@ func system_fs_handleOpr(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- //Check if the desintation is read only.
|
|
|
- /*
|
|
|
- accmode := userinfo.GetPathAccessPermission(string(vsrcFile))
|
|
|
- if accmode == "readonly" {
|
|
|
- sendErrorResponse(w, "This directory is Read Only.")
|
|
|
- return
|
|
|
- } else if accmode == "denied" {
|
|
|
- sendErrorResponse(w, "Access Denied")
|
|
|
- return
|
|
|
- }
|
|
|
- */
|
|
|
if !userinfo.CanWrite(vsrcFile) {
|
|
|
sendErrorResponse(w, "Access Denied.")
|
|
|
return
|
|
@@ -1687,9 +1685,7 @@ func system_fs_handleOpr(w http.ResponseWriter, r *http.Request) {
|
|
|
}
|
|
|
|
|
|
//Check if this file has any cached files. If yes, remove it
|
|
|
- if fileExists(filepath.ToSlash(filepath.Dir(rsrcFile)) + "/.cache/" + filepath.Base(rsrcFile) + ".jpg") {
|
|
|
- os.Remove(filepath.ToSlash(filepath.Dir(rsrcFile)) + "/.cache/" + filepath.Base(rsrcFile) + ".jpg")
|
|
|
- }
|
|
|
+ metadata.RemoveCache(rsrcFile)
|
|
|
|
|
|
//Clear the cache folder if there is no files inside
|
|
|
fc, _ := filepath.Glob(filepath.ToSlash(filepath.Dir(rsrcFile)) + "/.cache/*")
|
|
@@ -1725,9 +1721,7 @@ func system_fs_handleOpr(w http.ResponseWriter, r *http.Request) {
|
|
|
}
|
|
|
|
|
|
//Check if this file has any cached files. If yes, remove it
|
|
|
- if fileExists(filepath.ToSlash(filepath.Dir(rsrcFile)) + "/.cache/" + filepath.Base(rsrcFile) + ".jpg") {
|
|
|
- os.Remove(filepath.ToSlash(filepath.Dir(rsrcFile)) + "/.cache/" + filepath.Base(rsrcFile) + ".jpg")
|
|
|
- }
|
|
|
+ metadata.RemoveCache(rsrcFile)
|
|
|
|
|
|
//Clear the cache folder if there is no files inside
|
|
|
fc, _ := filepath.Glob(filepath.ToSlash(filepath.Dir(rsrcFile)) + "/.cache/*")
|