Skip to content

fix(harvest): strip locale query from instagram handle ('?hl=fr' stored as account)

Scaffold Digital Fleet requested to merge fix/harvest-instagram-query into master

Live harvest run (Catalyst, 2026-09-22 12:18): senat.fr publishes personal IG links like instagram.com/david_margueritte/?hl=fr; the handle extraction took the text after the last slash including the query -> stored ?hl=fr as the account (Margueritte).

Fix: strip the query first, then take the path segment; skip empty handles. Same bug class already fixed for twitter (_norm_handle) in !45 (merged); this closes the instagram write path.

Also applied a one-shot cleanup on dev: 9 reps' stored instagram URLs had locale/tracking queries stripped (incl. Margueritte's bare-junk value; next harvest self-heals it to the real handle — verified: https://instagram.com/david_margueritte now stored).

Idempotency: re-runs compare normalized paths (queries dropped), so no churn.

Merge request reports