Commit 8866ba2
authored
Fix ValueError from invalid CSS selectors in EmbedAPI (#12573)
This PR adds defensive handling for invalid CSS selectors in the
EmbedAPI to prevent crashes.
## Changes
- Added try-except blocks around calls to catch exceptions
- Invalid selectors now log a warning and return None instead of
crashing
- Applies to both the query parameter and fragment-based selectors
## Issue
Fixes: https://read-the-docs.sentry.io/issues/6923723755/
Previously, when malformed CSS selectors like `@@R06GA` were passed,
selectolax would raise a ValueError that wasn't caught, causing the
entire request to fail.1 parent f3708e1 commit 8866ba2
1 file changed
+10
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| |||
183 | 187 | | |
184 | 188 | | |
185 | 189 | | |
186 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
187 | 195 | | |
188 | 196 | | |
189 | 197 | | |
| |||
0 commit comments