Skip to content

Commit 4a347c8

Browse files
alperozturk96backportbot[bot]
authored andcommitted
fix: check deleted files for other local behaviour
Signed-off-by: alperozturk <[email protected]>
1 parent 8b48ebd commit 4a347c8

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

app/src/main/java/com/owncloud/android/operations/UploadFileOperation.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,15 +1300,21 @@ private void handleLocalBehaviour(File temporalFile,
13001300
File expectedFile,
13011301
File originalFile,
13021302
OwnCloudClient client) {
1303+
1304+
// only LOCAL_BEHAVIOUR_COPY not using original file
1305+
if (mLocalBehaviour != FileUploadWorker.LOCAL_BEHAVIOUR_COPY) {
1306+
// if file is not exists we should only delete from our app
1307+
deleteNonExistingFile(originalFile);
1308+
}
1309+
1310+
Log_OC.d(TAG, "handling local behaviour for: " + originalFile.getName() + " behaviour: " + mLocalBehaviour);
1311+
13031312
switch (mLocalBehaviour) {
13041313
case FileUploadWorker.LOCAL_BEHAVIOUR_DELETE:
13051314
try {
13061315
Files.delete(originalFile.toPath());
13071316
} catch (IOException e) {
13081317
Log_OC.e(TAG, "Could not delete original file: " + originalFile.getAbsolutePath(), e);
1309-
1310-
// if file is not exists we should only delete from our app
1311-
deleteNonExistingFile(originalFile);
13121318
}
13131319
mFile.setStoragePath("");
13141320
getStorageManager().deleteFileInMediaScan(originalFile.getAbsolutePath());
@@ -1321,6 +1327,9 @@ private void handleLocalBehaviour(File temporalFile,
13211327
move(temporalFile, expectedFile);
13221328
} catch (IOException e) {
13231329
Log_OC.e(TAG, e.getMessage());
1330+
1331+
// handling non-existing file for local copy as well
1332+
deleteNonExistingFile(temporalFile);
13241333
}
13251334
} else if (originalFile != null) {
13261335
try {

0 commit comments

Comments
 (0)