fix: Sanitize filename (#55)

This commit is contained in:
Kroese 2024-01-19 04:28:03 +01:00 committed by GitHub
parent 5137d513fc
commit 245b3fc019
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,16 +48,22 @@ fi
MSG="Please wait while Windows is being started..." MSG="Please wait while Windows is being started..."
if [ ! -f "$STORAGE/custom.iso" ]; then BASE="custom.iso"
if [ ! -f "$STORAGE/$BASE" ]; then
if [[ "$EXTERNAL" != [Yy1]* ]]; then if [[ "$EXTERNAL" != [Yy1]* ]]; then
if [ ! -f "$STORAGE/$VERSION.iso" ]; then BASE="$VERSION.iso"
if [ ! -f "$STORAGE/$BASE" ]; then
MSG="Please wait while Windows is being downloaded..." MSG="Please wait while Windows is being downloaded..."
fi fi
else else
BASE=$(basename "$VERSION") BASE=$(basename "${VERSION%%\?*}")
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
if [ ! -f "$STORAGE/$BASE" ]; then if [ ! -f "$STORAGE/$BASE" ]; then
MSG="Please wait while '$BASE' is being downloaded..." MSG="Please wait while '$BASE' is being downloaded..."
fi fi
@ -68,19 +74,6 @@ fi
# Display wait message # Display wait message
/run/server.sh "Windows" "$MSG" & /run/server.sh "Windows" "$MSG" &
BASE="custom.iso"
[ -f "$STORAGE/$BASE" ] && return 0
if [[ "$EXTERNAL" != [Yy1]* ]]; then
BASE="$VERSION.iso"
else
BASE=$(basename "$VERSION")
fi
[ -f "$STORAGE/$BASE" ] && return 0 [ -f "$STORAGE/$BASE" ] && return 0
TMP="$STORAGE/tmp" TMP="$STORAGE/tmp"
@ -250,8 +243,6 @@ else
[ -n "$XML" ] && error "Warning: XML file '$XML' does not exist, $FB" && echo [ -n "$XML" ] && error "Warning: XML file '$XML' does not exist, $FB" && echo
fi fi
info "Generating new ISO image for installation..."
ETFS="boot/etfsboot.com" ETFS="boot/etfsboot.com"
EFISYS="efi/microsoft/boot/efisys_noprompt.bin" EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
@ -264,6 +255,8 @@ if [ -f "$DIR/$ETFS" ]; then
ISO="$TMP/$LABEL.tmp" ISO="$TMP/$LABEL.tmp"
rm -f "$ISO" rm -f "$ISO"
info "Generating new ISO image for installation..."
genisoimage -b "$ETFS" -no-emul-boot -c "$CAT" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -quiet -V "$LABEL" -udf \ genisoimage -b "$ETFS" -no-emul-boot -c "$CAT" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -quiet -V "$LABEL" -udf \
-boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -o "$ISO" -allow-limited-size "$DIR" -boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -o "$ISO" -allow-limited-size "$DIR"