Implementation of File Exists Function; Delete FileInfos upon Permanent User Delete (#8958)

Check if file was deleted on FS

Warning message if file couldnt be removed
Этот коммит содержится в:
Daniel Schalla
2018-06-25 18:12:59 +02:00
коммит произвёл Harrison Healey
родитель fc158fce90
Коммит ecefa6cdd1
11 изменённых файлов: 270 добавлений и 0 удалений

Просмотреть файл

@@ -49,6 +49,18 @@ func (b *LocalFileBackend) ReadFile(path string) ([]byte, *model.AppError) {
}
}
func (b *LocalFileBackend) FileExists(path string) (bool, *model.AppError) {
_, err := os.Stat(filepath.Join(b.directory, path))
if os.IsNotExist(err) {
return false, nil
} else if err == nil {
return true, nil
}
return false, model.NewAppError("ReadFile", "api.file.file_exists.exists_local.app_error", nil, err.Error(), http.StatusInternalServerError)
}
func (b *LocalFileBackend) CopyFile(oldPath, newPath string) *model.AppError {
if err := CopyFile(filepath.Join(b.directory, oldPath), filepath.Join(b.directory, newPath)); err != nil {
return model.NewAppError("copyFile", "api.file.move_file.rename.app_error", nil, err.Error(), http.StatusInternalServerError)