Skip to content

Commit

Permalink
Fix b0rken OTGUtil.getDocumentFile()
Browse files Browse the repository at this point in the history
Addresses #4038, that under specific root URI the file/folders should be able to be found correctly.
  • Loading branch information
TranceLove committed Jan 12, 2024
1 parent 02afa4f commit ff6bfa5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
import java.util.EnumSet;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ public static void restoreFilesDialog(
new MaterialDialog.Builder(context)
.title(context.getString(R.string.restore_files))
.customView(dialogView, true)
.theme(appTheme.getMaterialDialogTheme(context))
.theme(appTheme.getMaterialDialogTheme())
.negativeText(context.getString(R.string.cancel).toUpperCase())
.positiveText(context.getString(R.string.done).toUpperCase())
.positiveColor(accentColor)
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/amaze/filemanager/utils/OTGUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ object OTGUtil {
var retval: DocumentFile? = DocumentFile.fromTreeUri(context, rootUri)
?: throw DocumentFileNotFoundException(rootUri, path)
val parts: Array<String> = if (openMode == OpenMode.DOCUMENT_FILE) {
path.substringAfter(URLDecoder.decode(rootUri.toString(), Charsets.UTF_8.name()))
URLDecoder.decode(path, Charsets.UTF_8.name()).substringAfter(
URLDecoder.decode(rootUri.toString(), Charsets.UTF_8.name())
)
.split("/", PATH_SEPARATOR_ENCODED).toTypedArray()
} else {
path.split("/").toTypedArray()
Expand Down

0 comments on commit ff6bfa5

Please sign in to comment.