Commit 606c21a
fix(og): map 'foreign beer' category to international-beer API endpoint (#290)
* fix(og): map 'foreign beer' category to international-beer API endpoint
The OG preview handler derives the API endpoint name directly from the
URL's category param. For foreign beer drinks the category field value
is 'foreign beer' (with a space) but the API endpoint is
'international-beer', so the handler fetched a non-existent URL and
silently fell back to the plain SPA — no OG metadata was injected.
Add a CATEGORY_TO_ENDPOINT lookup in fetchDrinkData so 'foreign beer'
resolves to 'international-beer.json', matching what the Flutter app
uses when loading these drinks.
* chore: update mise.lock node 21.7.3 → 22.22.3
* fix(og): use Object.hasOwn to guard category-to-endpoint lookup
Using bracket notation on a plain object lets inherited property names
like 'constructor' or '__proto__' resolve to non-string values and
produce a malformed upstream URL. Object.hasOwn checks own properties
only, so unknown categories fall through to the original value safely.
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent ec87295 commit 606c21a
3 files changed
Lines changed: 44 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
62 | | - | |
| 67 | + | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
266 | 290 | | |
267 | 291 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments