Skip to content

Commit

Permalink
fix: Strip query parameters from filename (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese committed Jan 19, 2024
1 parent f3e17e3 commit fab7767
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ else
BASE="DSM_VirtualDSM_42962"
fi

[ -n "$URL" ] && BASE=$(basename "$URL" .pat)
if [ -n "$URL" ]; then
PURL="${URL%%\?*}"
BASE=$(basename "$PURL" .pat)
fi

if [[ -f "$STORAGE/$BASE.boot.img" ]] && [[ -f "$STORAGE/$BASE.system.img" ]]; then
return 0 # Previous installation found
Expand All @@ -34,7 +37,8 @@ fi

[ -z "$URL" ] && URL="$DL/release/7.2.1/69057-1/DSM_VirtualDSM_69057.pat"

BASE=$(basename "$URL" .pat)
PURL="${URL%%\?*}"
BASE=$(basename "$PURL" .pat)

if [[ "$URL" != "file://$STORAGE/$BASE.pat" ]]; then
rm -f "$STORAGE/$BASE.pat"
Expand Down Expand Up @@ -165,7 +169,7 @@ fi

rm -rf "$TMP" && mkdir -p "$TMP"

info "Install: Downloading $(basename "$URL")..."
info "Install: Downloading $(basename "$PURL")..."

PAT="/$BASE.pat"
rm -f "$PAT"
Expand Down

0 comments on commit fab7767

Please sign in to comment.