Repository navigation
explorer 2026.11.18.1
fix(archive): list bare report links written as text in HTML mail (#79)
TLDR
OpenX's "full data report" mail puts its download link (a signed Google
Storage URL valid 7 days) as plain text inside the HTML. Explorer only
took bare URLs from text/plain and only anchors from HTML, so these
reports showed no download link and get_download_link refused them.
Explorer now lists them, the same way the archiver will.
Problem
bodyURLs (internal/archive/links.go) collects text/plain URLs, then
HTML <a href> anchors. A URL written as text in an HTML part is never
seen, so get_email lists no download link, has_payload misses the
email, and get_download_link answers that the URL is not a link of the
email.
Fix
extractHTMLTextURLs: the HTML with<style>/<script>blocks
removed (one-pass, ASCII case-insensitive, an unclosed element keeps the
rest), tags replaced by spaces (the existingtagRE), then the existing
text-URL extraction. Entities stay as written, like hrefs (hash
contract);FetchURLdecodes as before.bodyURLsappends them after plain-text URLs and anchors, skipping
any already seen as written or entity-decoded (a multipart/alternative
mail's plain part has&, its HTML&).- Mirrors the archiver change in ElcanoTek/production-support (ses-s3
extract_urls_from_html_text), so theurlreported is the string the
archiver hashes.testdata/html_text_urls.jsonis a copy of the shared
cases. docs/API.mdupdated.
Safe to deploy before the archiver change: until the archiver archives
these links, get_download_link finds the link but no cached copy (as
for any link the archiver failed to fetch).
Tests
Shared extraction cases, order and dedupe, and an OpenX-style link
listed with its extracted URL and decoded fetch URL; all three fail on
main. go vet ./..., golangci-lint run (0 issues) and go test -race ./... pass.
What's Changed
Full Changelog: v2026.11.17.1...v2026.11.18.1