diff --git a/app/src/main/java/com/termux/app/TermuxService.java b/app/src/main/java/com/termux/app/TermuxService.java index 0b3baaa6..141ebdaf 100644 --- a/app/src/main/java/com/termux/app/TermuxService.java +++ b/app/src/main/java/com/termux/app/TermuxService.java @@ -26,6 +26,7 @@ import com.termux.app.settings.properties.TermuxAppSharedProperties; import com.termux.app.terminal.TermuxTerminalSessionClient; import com.termux.app.utils.PluginUtils; import com.termux.shared.data.IntentUtils; +import com.termux.shared.data.UriUtils; import com.termux.shared.models.errors.Errno; import com.termux.shared.shell.ShellUtils; import com.termux.shared.termux.shell.TermuxShellEnvironmentClient; @@ -360,7 +361,10 @@ public final class TermuxService extends Service implements TermuxTask.TermuxTas executionCommand.inBackground = intent.getBooleanExtra(TERMUX_SERVICE.EXTRA_BACKGROUND, false); if (executionCommand.executableUri != null) { - executionCommand.executable = executionCommand.executableUri.getPath(); + Logger.logVerbose(LOG_TAG, "uri: \"" + executionCommand.executableUri + "\", path: \"" + executionCommand.executableUri.getPath() + "\", fragment: \"" + executionCommand.executableUri.getFragment() + "\""); + + // Get full path including fragment (anything after last "#") + executionCommand.executable = UriUtils.getUriFilePath(executionCommand.executableUri); executionCommand.arguments = IntentUtils.getStringArrayExtraIfSet(intent, TERMUX_SERVICE.EXTRA_ARGUMENTS, null); if (executionCommand.inBackground) executionCommand.stdin = IntentUtils.getStringExtraIfSet(intent, TERMUX_SERVICE.EXTRA_STDIN, null);