Skip to content

Commit 5029e13

Browse files
committed
Explicitly trim custom origin strings
1 parent eb50c5c commit 5029e13

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/deploy-cors-proxy.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ jobs:
7373
if [[ -n "${CUSTOM_SUPPORTED_ORIGINS_NEWLINE_SEPARATED}" ]]; then
7474
CUSTOM_ORIGINS_PHP="<?php define('PLAYGROUND_CORS_PROXY_SUPPORTED_ORIGINS', array("
7575
76-
echo "$CUSTOM_SUPPORTED_ORIGINS_NEWLINE_SEPARATED" | while read -r origin; do
76+
for origin in $CUSTOM_SUPPORTED_ORIGINS_NEWLINE_SEPARATED; do
77+
# Remove leading and trailing whitespace
78+
# NOTE: IIUC, this should already be happening as part of
79+
# string splitting, but it does not appear to be.
80+
origin="${origin##*([[:space:]])}"
81+
origin="${origin%%*([[:space:]])}"
82+
7783
if ! [[
7884
$origin =~ ^https?:\/\/(?:[a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}(?::\d{1,5})?$
7985
]]; then

0 commit comments

Comments
 (0)