fix: Check if file exists

This commit is contained in:
Kroese 2024-05-12 20:08:43 +02:00 committed by GitHub
parent f0ab26db30
commit 0c28ebd4ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,8 +18,12 @@ if [ -n "$URL" ]; then
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
fi
if [ -s "$STORAGE/$BASE.pat" ]; then
URL="file://$STORAGE/$BASE.pat"
if [[ "${URL,,}" != "http"* ]]; then
if [ -s "$STORAGE/$BASE.pat" ]; then
URL="file://$STORAGE/$BASE.pat"
else
error "File $STORAGE/$BASE.pat does not exist" && exit 65
fi
fi
fi