Skip to content

Commit

Permalink
SAF: don't use singleUri, that doesn't support eg. rename
Browse files Browse the repository at this point in the history
  • Loading branch information
lmagyar committed Sep 26, 2024
1 parent cb1eda2 commit 4895b06
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions primitiveFTPd/src/org/primftpd/filesystem/SafFileSystemView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand Down

0 comments on commit 4895b06

Please sign in to comment.