fix: Sanitize filename (#351)

This commit is contained in:
Kroese 2024-01-19 03:45:25 +01:00 committed by GitHub
parent ceba754d75
commit 911a775a90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,7 +21,9 @@ fi
BASE=$(basename "$BOOT")
BASE="${BASE%%\?*}"
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
[ -f "$STORAGE/$BASE" ] && return 0
TMP="$STORAGE/${BASE%.*}.tmp"