diff options
-rw-r--r-- | src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java | 3 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java b/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java index cc5e3fe70..d93618740 100644 --- a/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java +++ b/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java @@ -201,6 +201,9 @@ public class PgpDecryptionService { if (fixedFile.getParentFile().mkdirs()) { Log.d(Config.LOGTAG, "created parent directories for " + fixedFile.getAbsolutePath()); } + synchronized (mXmppConnectionService.FILENAMES_TO_IGNORE_DELETION) { + mXmppConnectionService.FILENAMES_TO_IGNORE_DELETION.add(outputFile.getAbsolutePath()); + } if (outputFile.renameTo(fixedFile)) { Log.d(Config.LOGTAG, "renamed " + outputFile.getAbsolutePath() + " to " + fixedFile.getAbsolutePath()); message.setRelativeFilePath(path); diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index b63588718..0ead8c393 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -305,6 +305,7 @@ public class XmppConnectionService extends Service { private final Set<OnKeyStatusUpdated> mOnKeyStatusUpdated = Collections.newSetFromMap(new WeakHashMap<OnKeyStatusUpdated, Boolean>()); private final Object LISTENER_LOCK = new Object(); + public final Set<String> FILENAMES_TO_IGNORE_DELETION = new HashSet<>(); private final OnBindListener mOnBindListener = new OnBindListener() { @Override @@ -2073,6 +2074,12 @@ public class XmppConnectionService extends Service { } private void markFileDeleted(final String path) { + synchronized (FILENAMES_TO_IGNORE_DELETION) { + if (FILENAMES_TO_IGNORE_DELETION.remove(path)) { + Log.d(Config.LOGTAG, "ignored deletion of " + path); + return; + } + } final File file = new File(path); final boolean isInternalFile = fileBackend.isInternalFile(file); final List<String> uuids = databaseBackend.markFileAsDeleted(file, isInternalFile); |