From f28ec0b413869426e8e06cab94100fcb45eee51d Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Tue, 22 Mar 2022 14:36:47 +0100 Subject: [PATCH] Fix error when moving folder with local storage if accessed directly Fixes #420 I have no idea why `DocumentsContract.getTreeDocumentId` don't work. The docs of this method is quiet useless especially because of the typo: "Extract the via Document#COLUMN_DOCUMENT_ID from the given URI". The method returns only the path segment directly after the `tree` section which means the root of the selected location. The good thing is that it is 100% reproducible and gets fixed by using `DocumentsContract.getDocumentId`. The problem exists since version 1.5.4. What I don't understand is why it worked in 1.5.3 because there the `DocumentsContract.getTreeDocumentId` returns the same garbage, I would understand the problem if it would exists since version 1.5.0 but 1.5.4 is weird. Crazy too is that this happens only with (crypto) folders and not (crypto) files. --- .../data/cloud/local/LocalStorageAccessFrameworkNodeFactory.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/src/main/java/org/cryptomator/data/cloud/local/LocalStorageAccessFrameworkNodeFactory.kt b/data/src/main/java/org/cryptomator/data/cloud/local/LocalStorageAccessFrameworkNodeFactory.kt index d65b3761..36379cbd 100644 --- a/data/src/main/java/org/cryptomator/data/cloud/local/LocalStorageAccessFrameworkNodeFactory.kt +++ b/data/src/main/java/org/cryptomator/data/cloud/local/LocalStorageAccessFrameworkNodeFactory.kt @@ -63,7 +63,7 @@ internal object LocalStorageAccessFrameworkNodeFactory { getNodePath(parent, documentFile.name), // documentFile.length(), // Date(documentFile.lastModified()), // - DocumentsContract.getTreeDocumentId(documentFile.uri), // + DocumentsContract.getDocumentId(documentFile.uri), // documentFile.uri.toString() ) }