From 3afa95a27030cacca2a094666276f00c3668cd65 Mon Sep 17 00:00:00 2001 From: BeyondMagic <51831435+BeyondMagic@users.noreply.github.com> Date: Mon, 26 Oct 2026 23:42:01 +0000 Subject: [PATCH] fix: download raw GitHub screenshot URLs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../submissions/Theme Submission Workflow.md | 3 +++ .../create-theme-submission-from-issue.mjs | 22 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/basic-memory/projects/firefoxcss-store/submissions/Theme Submission Workflow.md b/basic-memory/projects/firefoxcss-store/submissions/Theme Submission Workflow.md index 9e4678a..e19de5a 100644 --- a/basic-memory/projects/firefoxcss-store/submissions/Theme Submission Workflow.md +++ b/basic-memory/projects/firefoxcss-store/submissions/Theme Submission Workflow.md @@ -16,6 +16,8 @@ Approved submission PRs are finalized by `.github/workflows/publish-approved-the The issue-form automation was hardened on 2026-05-15 so user-correctable issue form errors exit as incomplete submissions, comment the required fix on the issue, and skip PR generation without hiding internal workflow failures. +GitHub `blob` screenshot links are normalized to include `raw=true` before download so submission automation stores the image rather than the GitHub HTML page. + ## Observations - [entry_point] New theme submissions use the `Submit a theme` GitHub Issue Form #submissions - [automation] Complete submission issues become candidate PRs #submissions @@ -26,6 +28,7 @@ The issue-form automation was hardened on 2026-05-15 so user-correctable issue f - [human_review] Maintainers still merge approved submission PRs explicitly #review - [issue_closure] Merged submission PRs close their source issue through `close-merged-theme-submission.yml` #issues - [hardening] On 2026-05-15, user-correctable issue form errors began exiting as incomplete submissions with a comment and no PR #history +- [screenshots] GitHub `blob` screenshot URLs receive `raw=true` before download #images ## Relations - contributes_to [[Theme Catalog Source of Truth]] diff --git a/scripts/create-theme-submission-from-issue.mjs b/scripts/create-theme-submission-from-issue.mjs index 717bc55..17613d7 100644 --- a/scripts/create-theme-submission-from-issue.mjs +++ b/scripts/create-theme-submission-from-issue.mjs @@ -195,11 +195,31 @@ function extractScreenshotUrls(value) { } function cleanUrl(value) { - return value + const cleaned = value .trim() .replace(/^["']+|["']+$/g, '') .replace(/[.,;:]+$/, '') .replace(/["'\]]+$/, '') + + return normalizeScreenshotUrl(cleaned) +} + +function normalizeScreenshotUrl(value) { + let url + + try { + url = new URL(value) + } catch { + return value + } + + if (['github.com', 'www.github.com'].includes(url.hostname.toLowerCase()) && url.pathname.includes('/blob/')) { + if (url.searchParams.get('raw') !== 'true') { + url.searchParams.set('raw', 'true') + } + } + + return url.toString() } function normalizeTags(value) {