mirror of
https://github.com/abraunegg/onedrive
synced 2026-03-14 14:35:46 +01:00
Ensure file is closed before renaming to improve compatibility with GCS buckets and network filesystems (#3299)
Some filesystems (e.g. GCS FUSE, Samba, NFS) may fail or behave unpredictably when attempting to rename an open file. This update explicitly closes the file before calling rename(), ensuring cross-platform and cloud storage compatibility. The original scope(exit) remains as a fallback to guarantee cleanup.
This commit is contained in:
parent
d9b8966fa4
commit
9113feac81
1 changed files with 5 additions and 0 deletions
|
|
@ -465,6 +465,11 @@ class CurlEngine {
|
|||
|
||||
http.perform();
|
||||
|
||||
// close open file - avoids problems with renaming on GCS Buckets and other semi-POSIX systems
|
||||
if (file.isOpen()){
|
||||
file.close();
|
||||
}
|
||||
|
||||
// Rename downloaded file
|
||||
rename(downloadFilename, originalFilename);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue