Skip to content

Commit

Permalink
fix #2799 curl's urlencode not work
Browse files Browse the repository at this point in the history
  • Loading branch information
vernesong committed Nov 16, 2022
1 parent 484756b commit c0c8a70
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 182 deletions.
6 changes: 1 addition & 5 deletions luci-app-openclash/root/usr/share/openclash/openclash.sh
Expand Up @@ -37,12 +37,8 @@ only_download=0
set_lock

urlencode() {
local data
if [ "$#" -eq 1 ]; then
data=$(curl -s -o /dev/null -w %{url_effective} --get --data-urlencode "key=$1" "")
if [ ! -z "$data" ]; then
echo -n "$(echo ${data##/?key=} |sed 's/\//%2f/g' |sed 's/:/%3a/g' |sed 's/?/%3f/g' |sed 's/(/%28/g' |sed 's/)/%29/g' |sed 's/\^/%5e/g' |sed 's/=/%3d/g' |sed 's/|/%7c/g' |sed 's/+/%20/g')"
fi
echo "$(/usr/share/openclash/openclash_urlencode.lua "$1")"
fi
}

Expand Down
Expand Up @@ -3,12 +3,8 @@
. /lib/functions.sh

urlencode() {
local data
if [ "$#" -eq 1 ]; then
data=$(curl -s -o /dev/null -w %{url_effective} --get --data-urlencode "key=$1" "")
if [ ! -z "$data" ]; then
echo -n "$(echo ${data##/?key=} |sed 's/\//%2f/g' |sed 's/:/%3a/g' |sed 's/?/%3f/g' |sed 's/(/%28/g' |sed 's/)/%29/g' |sed 's/\^/%5e/g' |sed 's/=/%3d/g' |sed 's/|/%7c/g' |sed 's/+/%20/g')"
fi
echo "$(/usr/share/openclash/openclash_urlencode.lua "$1")"
fi
}

Expand Down

0 comments on commit c0c8a70

Please sign in to comment.