Change summary
src/main/java/eu/siacs/conversations/persistance/FileBackend.java | 6
src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 2
2 files changed, 5 insertions(+), 3 deletions(-)
Detailed changes
@@ -101,7 +101,10 @@ public class FileBackend {
}
private static boolean isInDirectoryThatShouldNotBeScanned(Context context, File file) {
- String path = file.getAbsolutePath();
+ return isInDirectoryThatShouldNotBeScanned(context, file.getAbsolutePath());
+ }
+
+ public static boolean isInDirectoryThatShouldNotBeScanned(Context context, String path) {
for(String type : new String[]{RecordingActivity.STORAGE_DIRECTORY_TYPE_NAME, "Files"}) {
if (path.startsWith(getConversationsDirectory(context, type))) {
return true;
@@ -280,7 +283,6 @@ public class FileBackend {
}
public static boolean isPathBlacklisted(String path) {
- Environment.getDataDirectory();
final String androidDataPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/";
return path.startsWith(androidDataPath);
}
@@ -1113,7 +1113,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
if (m.isFileOrImage() && !deleted) {
String path = m.getRelativeFilePath();
- if (path == null || !path.startsWith("/")) {
+ if (path == null || !path.startsWith("/") || FileBackend.isInDirectoryThatShouldNotBeScanned(getActivity(), path) ) {
deleteFile.setVisible(true);
deleteFile.setTitle(activity.getString(R.string.delete_x_file, UIHelper.getFileDescriptionString(activity, m)));
}