mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
@@ -21,13 +21,13 @@ import (
|
||||
|
||||
func validateBackupFile(outputFile string) (string, error) {
|
||||
if outputFile == "" {
|
||||
return "", errors.New("Invalid or missing output-file")
|
||||
return "", errors.New("invalid or missing output-file")
|
||||
}
|
||||
if filepath.IsAbs(outputFile) {
|
||||
return "", fmt.Errorf("Invalid output-file %#v: it must be a relative path", outputFile)
|
||||
return "", fmt.Errorf("invalid output-file %#v: it must be a relative path", outputFile)
|
||||
}
|
||||
if strings.Contains(outputFile, "..") {
|
||||
return "", fmt.Errorf("Invalid output-file %#v", outputFile)
|
||||
return "", fmt.Errorf("invalid output-file %#v", outputFile)
|
||||
}
|
||||
outputFile = filepath.Join(backupsPath, outputFile)
|
||||
return outputFile, nil
|
||||
@@ -122,7 +122,7 @@ func loadData(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
if !filepath.IsAbs(inputFile) {
|
||||
sendAPIResponse(w, r, fmt.Errorf("Invalid input_file %#v: it must be an absolute path", inputFile), "", http.StatusBadRequest)
|
||||
sendAPIResponse(w, r, fmt.Errorf("invalid input_file %#v: it must be an absolute path", inputFile), "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
fi, err := os.Stat(inputFile)
|
||||
@@ -207,7 +207,7 @@ func RestoreFolders(folders []vfs.BaseVirtualFolder, inputFile string, mode, sca
|
||||
continue
|
||||
}
|
||||
folder.ID = f.ID
|
||||
err = dataprovider.UpdateFolder(&folder)
|
||||
err = dataprovider.UpdateFolder(&folder, f.Users)
|
||||
logger.Debug(logSender, "", "restoring existing folder: %+v, dump file: %#v, error: %v", folder, inputFile, err)
|
||||
} else {
|
||||
folder.Users = nil
|
||||
|
||||
Reference in New Issue
Block a user