← back to Marketing Command Center
fix(mcc): IG re-pull only touches at-risk images, never clobbers stable URLs
214b1bb68dd5e41b6c712e6165a47f521b24386a · 2026-07-22 11:05:17 -0700 · Steve Abrams
The re-pull was over-eager — it would refresh a published-IG post even when its
mediaUrl is already a durable cdn.shopify.com image, downgrading a full-res photo
to a square IG thumbnail. Now it only targets items whose current mediaUrl is
missing or an expiring ig/fbcdn signed URL; stable non-IG hosts are left alone.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
M scripts/ig-media-repull.js
Diff
commit 214b1bb68dd5e41b6c712e6165a47f521b24386a
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Jul 22 11:05:17 2026 -0700
fix(mcc): IG re-pull only touches at-risk images, never clobbers stable URLs
The re-pull was over-eager — it would refresh a published-IG post even when its
mediaUrl is already a durable cdn.shopify.com image, downgrading a full-res photo
to a square IG thumbnail. Now it only targets items whose current mediaUrl is
missing or an expiring ig/fbcdn signed URL; stable non-IG hosts are left alone.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
scripts/ig-media-repull.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/scripts/ig-media-repull.js b/scripts/ig-media-repull.js
index b090347..9f81246 100644
--- a/scripts/ig-media-repull.js
+++ b/scripts/ig-media-repull.js
@@ -44,10 +44,16 @@ const tokenForIg = igId => {
return (pg && pg.token) || env('META_ACCESS_TOKEN') || env('IG_ACCESS_TOKEN') || '';
};
-// Extract every {item, mediaId, igId} where a post was published to IG.
+// Only images actually at risk of blanking: a missing mediaUrl, or an expiring
+// IG/fbcdn signed URL. A stable non-IG URL (e.g. cdn.shopify.com) already works
+// and is durable — never clobber it with a lower-res square IG thumbnail.
+const atRisk = url => !url || /(^|\.)(cdninstagram\.com|fbcdn\.net)/i.test((() => { try { return new URL(url).host; } catch { return ''; } })());
+
+// Extract every at-risk {item, mediaId, igId} where a post was published to IG.
function igPublishTargets(items) {
const out = [];
for (const it of items) {
+ if (!atRisk(it.mediaUrl)) continue; // current image is stable/working — leave it
const dets = Array.isArray(it.detail) ? it.detail : [];
for (const d of dets) {
if (d && d.id && (d.igId || /instagram/i.test(it.channel || ''))) out.push({ it, mediaId: String(d.id), igId: d.igId ? String(d.igId) : null });
← 971082a feat(mcc): IG Graph API re-pull to restore durable thumbnail
·
back to Marketing Command Center
·
chore(mcc): daily launchd job for the IG media re-pull (Mac2 6d2f55b →