Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 7074:ec8be5bd8bd6
bug: fix crash unguarded reference allowed_origins[0]
Make sure allowed_origins is not empty.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 24 Nov 2022 11:33:24 -0500 |
| parents | bc06bad26872 |
| children | b34d1808b0aa |
comparison
equal
deleted
inserted
replaced
| 7073:67e7225c4343 | 7074:ec8be5bd8bd6 |
|---|---|
| 1288 | 1288 |
| 1289 if not api: | 1289 if not api: |
| 1290 return False | 1290 return False |
| 1291 | 1291 |
| 1292 allowed_origins = self.db.config['WEB_ALLOWED_API_ORIGINS'] | 1292 allowed_origins = self.db.config['WEB_ALLOWED_API_ORIGINS'] |
| 1293 if allowed_origins[0] == '*': | 1293 if allowed_origins and allowed_origins[0] == '*': |
| 1294 return True | 1294 return True |
| 1295 | 1295 |
| 1296 # For referer, loop over allowed_api_origins and | 1296 # For referer, loop over allowed_api_origins and |
| 1297 # see if any of them are a prefix to referer, case sensitive. | 1297 # see if any of them are a prefix to referer, case sensitive. |
| 1298 # Append / to each origin so that: | 1298 # Append / to each origin so that: |
