Skip to content

Commit

Permalink
resolve uri from intents from new intent filter
Browse files Browse the repository at this point in the history
  • Loading branch information
seelchen committed Feb 3, 2024
1 parent 3035fac commit 2edf7f8
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
import com.amaze.filemanager.filesystem.PasteHelper;
import com.amaze.filemanager.filesystem.RootHelper;
import com.amaze.filemanager.filesystem.files.FileUtils;
import com.amaze.filemanager.filesystem.files.UriUtilsKt;
import com.amaze.filemanager.filesystem.ftp.NetCopyClientConnectionPool;
import com.amaze.filemanager.filesystem.ftp.NetCopyConnectionInfo;
import com.amaze.filemanager.filesystem.ssh.SshClientUtils;
Expand Down Expand Up @@ -631,6 +632,25 @@ private void checkForExternalIntent(Intent intent) {
* http://teamamaze.xyz/open_file?path=path-to-file
*/
path = Utils.sanitizeInput(uri.getQueryParameter("path"));
} else if (ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())
|| ContentResolver.SCHEME_FILE.equals(uri.getScheme())) {
File fromUri = null;
try {
String path = UriUtilsKt.fromUri(uri, this);
if (path != null) {
fromUri = new File(path);
}
} catch (Exception ignored) {
}

if (fromUri != null && fromUri.getParent() != null) {
path = Utils.sanitizeInput(fromUri.getParent());
scrollToFileName = Utils.sanitizeInput(fromUri.getName());
} else {
Toast.makeText(this, getString(R.string.error_file_not_found), Toast.LENGTH_LONG).show();
path = null;
scrollToFileName = null;
}
} else {
LOG.warn(getString(R.string.error_cannot_find_way_open));
}
Expand Down

0 comments on commit 2edf7f8

Please sign in to comment.