From 4895b066cceb2a56f4ad809c001a535e7465fb92 Mon Sep 17 00:00:00 2001 From: Laszlo Magyar Date: Wed, 4 Sep 2024 00:07:39 +0200 Subject: [PATCH] SAF: don't use singleUri, that doesn't support eg. rename --- .../org/primftpd/filesystem/SafFileSystemView.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/primitiveFTPd/src/org/primftpd/filesystem/SafFileSystemView.java b/primitiveFTPd/src/org/primftpd/filesystem/SafFileSystemView.java index 3dba6639..bfddd20b 100644 --- a/primitiveFTPd/src/org/primftpd/filesystem/SafFileSystemView.java +++ b/primitiveFTPd/src/org/primftpd/filesystem/SafFileSystemView.java @@ -78,8 +78,7 @@ public T getFile(String file) { childrenUri, new String[] { DocumentsContract.Document.COLUMN_DOCUMENT_ID, - DocumentsContract.Document.COLUMN_DISPLAY_NAME, - DocumentsContract.Document.COLUMN_MIME_TYPE + DocumentsContract.Document.COLUMN_DISPLAY_NAME }, null, null, @@ -88,19 +87,13 @@ public T getFile(String file) { while (childCursor.moveToNext()) { String docId = childCursor.getString(0); String docName = childCursor.getString(1); - String docMimeType = childCursor.getString(2); if (currentPart.equals(docName)) { if (i == parts.size() - 1) { Uri docUri = DocumentsContract.buildDocumentUriUsingTree(startUrl, docId); Uri parentUri = DocumentsContract.buildDocumentUriUsingTree(startUrl, parentId); logger.trace(" calling createFile() for doc: {}, docId: {}, docUri: {}, parentId: {}, parentUri: {}", new Object[]{currentPart, docId, docUri, parentId, parentUri}); DocumentFile parentDocFile = DocumentFile.fromTreeUri(context, parentUri); - DocumentFile docFile = null; - if (docMimeType.equals(DocumentsContract.Document.MIME_TYPE_DIR)) { - docFile = DocumentFile.fromTreeUri(context, docUri); - } else { - docFile = DocumentFile.fromSingleUri(context, docUri); - } + DocumentFile docFile = DocumentFile.fromTreeUri(context, docUri); String absPath = Utils.toPath(parts); return createFile(contentResolver, parentDocFile, docFile, absPath, pftpdService); } else {