Skip to content

fix: build !path geojson.io link as a base64 data URI - #20

Merged
sg merged 1 commit into
mainfrom
fix/path-geojson-base64
Jun 15, 2026
Merged

sg merged 1 commit into
mainfrom
fix/path-geojson-base64

Conversation

@sg

@sg sg commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Problem

!path map links still failed on geojson.io ("unterminated string in the json data") even after the slash-encoding fix (#19) — including paths with no / in any name.

Diagnosis

Resolving a failing da.gd link showed the data arrives intact and parses as valid, complete JSON — so it's geojson.io's rewritten (early-2026) loader mishandling our percent-encoded inline #data=data:application/json,… form, not our data. Confirmed by testing the exact failing payload in several formats:

  • A — current percent-encoded inline → fails
  • B — data:application/json;base64,<b64> → works
  • C — bare base64 → invalid URL
  • D — a tiny inline payload → works

A fails while D (tiny) works ⇒ a size/encoding-bloat problem with the inline form (percent-encoding inflates the payload ~3×). Base64 (B) is reliable and ~20% shorter.

Fix

_geojson_io_url now base64-encodes the GeoJSON into a ;base64, data URI. Dropped the unused urllib.parse import; added base64. This also subsumes the earlier slash issue — base64 has no characters that need escaping in a fragment.

Verification

New format round-trips to valid JSON through base64 and through da.gd; tested with hop names containing /, #, and emoji. py_compile clean.

@sg
sg merged commit fba6b09 into main Jun 15, 2026
1 check passed
@sg
sg deleted the fix/path-geojson-base64 branch June 15, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant