Skip to content

Commit 07ee5cc

Browse files
committed
Fix wildcard conversion
1 parent 32ad18f commit 07ee5cc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/CorsService.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ private function normalizeOptions(array $options = []): array
6464
}
6565
}
6666

67+
// Transform wildcard pattern
68+
foreach ($options['allowedOrigins'] as $origin) {
69+
if (strpos($origin, '*') !== false) {
70+
$options['allowedOriginsPatterns'][] = $this->convertWildcardToPattern($origin);
71+
}
72+
}
73+
6774
// normalize array('*') to true
6875
if (in_array('*', $options['allowedOrigins'])) {
6976
$options['allowedOrigins'] = true;
@@ -80,13 +87,6 @@ private function normalizeOptions(array $options = []): array
8087
$options['allowedMethods'] = array_map('strtoupper', $options['allowedMethods']);
8188
}
8289

83-
// Transform wildcard pattern
84-
foreach ($options['allowedOrigins'] as $origin) {
85-
if (strpos($origin, '*') !== false) {
86-
$options['allowedOriginsPatterns'][] = $this->convertWildcardToPattern($origin);
87-
}
88-
}
89-
9090
return $options;
9191
}
9292

0 commit comments

Comments
 (0)