diff --git a/scripts/termux-share b/scripts/termux-share index bc5056f..7c33ef2 100755 --- a/scripts/termux-share +++ b/scripts/termux-share @@ -42,16 +42,13 @@ shift $(($OPTIND-1)) if [ $# -gt 1 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi if [ $# != 0 ]; then - FILE="$1" - if [ -f "$FILE" ]; then - FILE=`realpath "$FILE"` + if [ ! -f "$1" ]; then + echo "$1 is not a file" + exit 1 fi - # Fix for issues on Android 8.1. - FILE=$(echo "$FILE" | sed 's/^\///') - # Note that the file path can contain whitespace. - /data/data/com.termux/files/usr/libexec/termux-api Share $PARAMS --es file "$FILE" + /data/data/com.termux/files/usr/libexec/termux-api Share $PARAMS --es file "$(realpath "$1")" else /data/data/com.termux/files/usr/libexec/termux-api Share $PARAMS fi