mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-29 19:02:59 +02:00
Update sync.d
* Move 'thisFileSize = getSize(fileToUpload)' back to original location * Add check if path exists before attempting upload
This commit is contained in:
parent
e2f1b68b1a
commit
d5185e5207
23
src/sync.d
23
src/sync.d
|
@ -4748,17 +4748,19 @@ class SyncEngine {
|
||||||
parentItem.driveId = appConfig.defaultDriveId;
|
parentItem.driveId = appConfig.defaultDriveId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the new file size
|
// Check if the path still exists locally before we try to upload
|
||||||
// Even if the permissions on the file are: -rw-------. 1 root root 8 Jan 11 09:42
|
if (exists(fileToUpload)) {
|
||||||
// We can obtain the file size
|
|
||||||
thisFileSize = getSize(fileToUpload);
|
|
||||||
|
|
||||||
// Can we read the file - as a permissions issue or actual file corruption will cause a failure
|
// Can we read the file - as a permissions issue or actual file corruption will cause a failure
|
||||||
// Resolves: https://github.com/abraunegg/onedrive/issues/113
|
// Resolves: https://github.com/abraunegg/onedrive/issues/113
|
||||||
// readLocalFile cannot 'read' 1 byte of data from a zero byte file size ..
|
if (readLocalFile(fileToUpload)) {
|
||||||
if (readLocalFile(fileToUpload) || (thisFileSize == 0)) {
|
|
||||||
if (parentPathFoundInDB) {
|
|
||||||
// The local file can be read - so we can read it to attemtp to upload it in this thread
|
// The local file can be read - so we can read it to attemtp to upload it in this thread
|
||||||
|
// Is the path parent in the DB?
|
||||||
|
if (parentPathFoundInDB) {
|
||||||
|
// Parent path is in the database
|
||||||
|
// Get the new file size
|
||||||
|
// Even if the permissions on the file are: -rw-------. 1 root root 8 Jan 11 09:42
|
||||||
|
// we can still obtain the file size, however readLocalFile() also tests if the file can be read (permission check)
|
||||||
|
thisFileSize = getSize(fileToUpload);
|
||||||
|
|
||||||
// Does this file exceed the maximum filesize for OneDrive
|
// Does this file exceed the maximum filesize for OneDrive
|
||||||
// Resolves: https://github.com/skilion/onedrive/issues/121 , https://github.com/skilion/onedrive/issues/294 , https://github.com/skilion/onedrive/issues/329
|
// Resolves: https://github.com/skilion/onedrive/issues/121 , https://github.com/skilion/onedrive/issues/294 , https://github.com/skilion/onedrive/issues/329
|
||||||
|
@ -4943,6 +4945,11 @@ class SyncEngine {
|
||||||
addLogEntry("Skipping uploading this file as it cannot be read (file permissions or file corruption): " ~ fileToUpload);
|
addLogEntry("Skipping uploading this file as it cannot be read (file permissions or file corruption): " ~ fileToUpload);
|
||||||
uploadFailed = true;
|
uploadFailed = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// File disappeared before upload
|
||||||
|
addLogEntry("File disappeared locally before upload: " ~ fileToUpload);
|
||||||
|
// dont set uploadFailed = true; as the file disappeared before upload, thus nothing here failed
|
||||||
|
}
|
||||||
|
|
||||||
// Upload success or failure?
|
// Upload success or failure?
|
||||||
if (uploadFailed) {
|
if (uploadFailed) {
|
||||||
|
|
Loading…
Reference in a new issue