fix: fire ids leaked into URLs as ObjectID("...") on Mongo 7

Fire collections use idGeneration:'MONGO', so _id is a Mongo.ObjectID whose
toString() is ObjectID("<hex>"), not the bare hex. Interpolating _id into a
URL produced /fire/archive/ObjectID("c0..."), which no route matches -> the
fire-detail page 404'd. New hexId() helper returns the 24-char hex for an
ObjectID (and passes plain strings through); applied at the three string-context
sites: the map-marker click URL (MarkListeners), the active->archive redirect,
and the comments referenceId (Fires.js). Left falsePositives.insert untouched —
its check() expects a Meteor.Collection.ObjectID, so it takes the object.

Verified in browser: /fire/archive/<hex> and /fire/active/<hex> render the
detail page (map + comments), URL stays clean hex, no ObjectID( anywhere.
This commit is contained in:
vjrj 2026-07-17 18:31:59 +02:00
parent c6c22643c1
commit 9feaca9d0b
3 changed files with 22 additions and 3 deletions

View file

@ -1,4 +1,7 @@
import { hexId } from '/imports/api/Common/id';
export const onMarkClick = (history, nasa, id) => {
// console.log('onClick fired');
history.push(`/fire/${nasa ? 'active' : 'alert'}/${id}`);
// hexId: `id` is a Mongo.ObjectID whose toString() is `ObjectID("...")`.
history.push(`/fire/${nasa ? 'active' : 'alert'}/${hexId(id)}`);
};