Upstream: GPX upload hard-fails when a waypoint description exceeds 5000 chars #15
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while bulk-importing 1104 komoot GPX — 26 multi-day routes (Westweg, Haute Route, Tatra Traverse, Brienzergrat…) failed to upload.
Bug:
PUT /api/v1/trail/upload(and the folder watcher) hard-fails the entire trail with500 Failed to create recordwhen any waypoint'sdescriptionexceeds the waypoints collection limit of 5000 characters. komoot POI/highlight descriptions routinely run 5–6.5k chars.Root cause:
trails_create → waypoints_createpropagates the PocketBasevalidation_max_text_constraint(5000) as a fatal error; the whole GPX (track + all waypoints) is rejected, so the route is lost, not just the one over-long POI.Repro: upload a GPX whose
<wpt><desc>is >5000 chars.Proposed fix (upstream): truncate an over-long waypoint description to the limit (with an ellipsis) — or skip/relax that single waypoint — instead of aborting the entire trail import. A one-line clamp in the GPX→waypoint mapping (
gpx_util) would do it.Workaround used for our archive: pre-truncate
<desc>to ≤4800 before import.Fix up in #37 (branch
fix/waypoint-description-clamp, basemain).Approach: clamp the waypoint description to the
waypointscollection's own limit (rune-safe, ellipsis) increateWaypointsbeforeapp.Save, so one over-long POI no longer aborts the whole trail import — mirroring the existingphotoFilesskip-don't-fail behaviour. Reading the limit from the collection field keeps it correct if the schema limit changes.Test-first:
TestCreateWaypointsClampsOverlongDescriptionreproduced the exactdescription: Must be no more than 5000 character(s)abort against a real PocketBase test app before the fix; also aTestClampToRuneLimittable test. Fullplugins/importersuite +go vet+go build ./...green.Prepared during holiday-autopilot — not merged. Upstream submission to open-wanderer/wanderer (dev branch) is the remaining step (owner).
Expanded this fix to the sibling fields while here: the importer also wrote the waypoint name and the trail name/description unclamped, so an over-long value in any of them aborted the whole import identically (confirmed for waypoint name:
name: Must be no more than 255 character(s)). #37 now adds aclampTextFieldhelper that clamps each field to its own limit and applies it to all of them — addedTestCreateWaypointsClampsOverlongName; full importer suite + vet + build green. Still not merged.