Resolve a giphy token with no metadata to look it up in
`` is a token, not an address, and the only thing that turned it into one was a lookup in the comment's own `media_metadata`. Reddit ships plenty of comments carrying such a token and no `media_metadata` at all, and with nothing to look it up in the token itself was what the comment showed. Giphy is the one of the three token kinds whose id means something off Reddit, so that one can be resolved without the lookup. A variant name after the id is dropped: Giphy does not serve every variant of every gif, but the full one is always there. The other two still resolve only through the metadata. An emote id and an upload id name nothing outside Reddit, so with no entry for them there is still nothing to point them at. Closes #10 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PLkmgp1fWbA4XbarxKdRKt
This commit is contained in:
@@ -149,11 +149,15 @@ Things worth knowing before editing:
|
||||
bodies are Markdown, rendered by `src/render/markdown.ts` — escape first, then put
|
||||
back the constructs we chose to support, never `body_html`. An image in a comment is
|
||||
written as a token rather than an address — ``,
|
||||
``, `` — and in every case the token is
|
||||
a key in that same comment's own `media_metadata`, so `resolveInlineImages` is one
|
||||
lookup rather than three special cases. A bare `preview.redd.it` address pasted into a
|
||||
comment is in there too, keyed by the id inside the URL. Prefer `s.gif` over `s.mp4`
|
||||
for an animated one: a GIF moves in an `<img>` and an MP4 needs a player. An address
|
||||
``, `` — and the token is usually a key
|
||||
in that same comment's own `media_metadata`, so `resolveInlineImages` is one lookup
|
||||
rather than three special cases. Usually: plenty of comments carry a Giphy token and
|
||||
no `media_metadata` at all, and Giphy is the one of the three whose id means something
|
||||
off Reddit, so that token alone falls back to `i.giphy.com/media/<id>/giphy.gif`. A
|
||||
variant name after the id is dropped — Giphy does not serve every variant of every
|
||||
gif. A bare `preview.redd.it` address pasted into a comment is in there too, keyed by
|
||||
the id inside the URL. Prefer `s.gif` over `s.mp4` for an animated one: a GIF moves in
|
||||
an `<img>` and an MP4 needs a player. An address
|
||||
typed without a scheme counts as well, but only when it ends in an image extension —
|
||||
the rule wants a host, a path *and* that extension, because comments are full of
|
||||
dotted, slashed prose that must not turn into links.
|
||||
|
||||
Reference in New Issue
Block a user