fix: stop parsing if URL does not have a schema

This commit is contained in:
2024-10-22 13:57:00 -03:00
parent b0158de28d
commit 7319a6fcb7

View File

@@ -14,6 +14,10 @@ queryless_url="${DB_URL%%\?*}";
# get URL's schema # get URL's schema
schema="${queryless_url%//*}"; schema="${queryless_url%//*}";
if test "${schema}" = "${queryless_url}"; then
echo >&2 "database URLs must start with schema (i.e.: mysql://)"\
&& exit 2;
fi
schemaless_url=${queryless_url#*//}; schemaless_url=${queryless_url#*//};
# left hand is everything until the first @ (the user part) # left hand is everything until the first @ (the user part)