Skip to content

Commit e90d3a2

Browse files
committed
Update parse_cors function to work for edge case when nothing is provided after or between commas
1 parent ead5fa8 commit e90d3a2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

backend/app/core/config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818

1919
def parse_cors(v: Any) -> list[str] | str:
2020
if isinstance(v, str) and not v.startswith("["):
21-
if not v.strip():
22-
return []
23-
return [i.strip() for i in v.split(",")]
21+
return [i.strip() for i in v.split(",") if i.strip()]
2422
elif isinstance(v, list | str):
2523
return v
2624
raise ValueError(v)

0 commit comments

Comments
 (0)