Avoid encoding commonplace characters in tree names

* java/org/gnu/emacs/EmacsService.java (getDocumentTrees): Don't
encode some characters that need not be escaped within file
names.
This commit is contained in:
Po Lu 2023-08-04 08:32:05 +08:00
parent 1dedd84e42
commit 709195fea6

View file

@ -1294,8 +1294,12 @@ else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
if (DocumentsContract.isTreeUri (uri)
&& uri.getAuthority ().equals (providerName)
&& permission.isReadPermission ())
/* Make sure the tree document ID is encoded. */
treeList.add (Uri.encode (DocumentsContract.getTreeDocumentId (uri)));
/* Make sure the tree document ID is encoded. Refrain from
encoding characters such as +:&?#, since they don't
conflict with file name separators or other special
characters. */
treeList.add (Uri.encode (DocumentsContract.getTreeDocumentId (uri),
" +:&?#"));
}
return treeList.toArray (new String[0]);