fixed getNameFromContentUri so it should always get the file name, if it is present

This commit is contained in:
jensMF 2019-11-05 14:42:25 +01:00
parent 934d0e8ab9
commit 6ad8969824

View file

@ -164,7 +164,7 @@ public class ImportHelper {
private String getNameFromContentUri(Uri contentUri) { private String getNameFromContentUri(Uri contentUri) {
final String name; final String name;
final Cursor returnCursor = app.getContentResolver().query(contentUri, null, null, null, null); final Cursor returnCursor = app.getContentResolver().query(contentUri, new String[] {OpenableColumns.DISPLAY_NAME}, null, null, null);
if (returnCursor != null && returnCursor.moveToFirst()) { if (returnCursor != null && returnCursor.moveToFirst()) {
int columnIndex = returnCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME); int columnIndex = returnCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
if (columnIndex != -1) { if (columnIndex != -1) {