Normalize connection URLs on the read path#1998
Merged
Merged
Conversation
Strip newlines and surrounding whitespace from connection URLs in normalizeConnection, so existing connections with pasted whitespace/newlines work without re-saving, including the graph-db-connection-url proxy header. normalizeConnection also tolerates a missing url key: persisted configs are not schema-validated on read, so a stored connection can lack url and previously crashed mergedConfigurationSelector app-wide via undefined.replace. Exported connection files clean the url too, and omit an empty graphDbUrl so a non-proxy export survives its own import validation. Export is refused with a toast when a connection has no usable url; the save-a-copy-then-delete flow now deletes only when the backup copy was actually written.
kmcginnes
marked this pull request as ready for review
July 23, 2026 22:42
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #1982, which trimmed URL whitespace only on connection-form submit — that never repairs connections already persisted with bad data. This normalizes at the read path instead, so existing connections work without being re-saved.
normalizeConnectionnow strips newlines and surrounding whitespace (in addition to the existing trailing-slash) fromurlandgraphDbUrl. Because it feeds every request and thegraph-db-connection-urlproxy header, existing bad data is repaired on read.normalizeConnectionalso tolerates a missingurlkey. Persisted configs are not schema-validated on read, so a stored connection can lackurldespite the compile-time required type; previously this crashed the connection view app-wide viaundefined.replace.urltoo and omit an emptygraphDbUrl, so a non-proxy export survives its own import validation.Out of scope, by design: the connection form (
CreateConnection.tsx, being reworked separately), any IndexedDB migration, and Zod-on-read for stored configs.Validation
pnpm checksand fullpnpm testpass (all suites green).urltolerance innormalizeConnection; clean re-importable export for both non-proxy (graphDbUrlomitted) and proxy connections; export-refused toast; and delete-skipped-when-refused in the save-a-copy flow.How to read
normalizeUrlhelper and its use innormalizeConnectiongraphDbUrlomissionRelated Issues
Check List
pnpm checkspasses with no errors.pnpm testpasses with no failures.