mirror of
https://github.com/filebrowser/filebrowser.git
synced 2026-01-23 02:35:10 +00:00
feat: force file sync while uploading file (#5668)
This commit is contained in:
parent
94ec786d34
commit
4fd18a382c
2 changed files with 12 additions and 0 deletions
|
|
@ -280,6 +280,12 @@ func writeFile(afs afero.Fs, dst string, in io.Reader, fileMode, dirMode fs.File
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// Sync the file to ensure all data is written to storage.
|
||||
// to prevent file corruption.
|
||||
if err := file.Sync(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Gets the info about the file.
|
||||
info, err := file.Stat()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue