Skip to content

Commit

Permalink
fix: [#295] decode file protocol url properly
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick330602 committed Dec 29, 2023
1 parent b6fa4b7 commit 7c6a9ed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wslview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ skip_validation_check=${WSLVIEW_SKIP_VALIDATION_CHECK:-1}

help_short="$0 [-hsvur]\n$0 [-E ENGINE] LINK/FILE"

function fileprotocoldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }

function del_reg_alt {
if [ "$distro" == "archlinux" ] || [ "$distro" == "alpine" ]; then
error_echo "Unsupported action for this distro. Aborted." 34
Expand Down Expand Up @@ -55,6 +57,8 @@ if [[ "$lname" != "" ]]; then
# file:/// protocol used in linux
if [[ "$lname" =~ ^file:\/\/.*$ ]] && [[ ! "$lname" =~ ^file:\/\/(\/)+[A-Za-z]\:.*$ ]]; then
debug_echo "Received file:/// protocol used in linux"
# convert before set
lname="$(fileprotocoldecode "$lname")"
[ "$wslutmpbuild" -ge "$BN_MAY_NINETEEN" ] || error_echo "This protocol is not supported before version 1903." 34
properfile_full_path="$(readlink -f "${lname//file:\/\//}")"
# Linux absolute path
Expand Down

0 comments on commit 7c6a9ed

Please sign in to comment.