Repository navigation
fix(connections): URL import edge cases: raw special characters, Windows SQLite, IPv6 (#1315) - #1329
Merged
Merged
Conversation
…ows SQLite, IPv6 (#1315) - A password with @, /, # or ? written as is no longer ends in 'Invalid URL/URI format.': the user info up to the last @ is percent-encoded and the stored string is the valid one. When it still cannot be read, the message names percent-encoding. - sqlite:///C:/data/app.db is C:/data/app.db, without the URI's slash. - An IPv6 host is bracketed in the default name and in the Mongo URI the connection builds.
3 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.
Closes #1315
Problem (
connection_url_parser.dart)postgres://user:p@ss@host/db,...:p#ss@...andmysql://root:pa/ss@host/dbmakeUri.tryParsereturnnull: the user got only Invalid URL/URI format., for the commonest cause (a raw password copied from a cloud console) and with no word about encoding.sqlite:///C:/data/app.dbgave the path/C:/data/app.db, which does not exist on Windows.uri.hostis::1without brackets, so the default name readPostgreSQL: ::1:5432and a Mongo URI built from the host was invalid.Fix
Urirejects, the user info (up to the last@before the query) is percent-encoded, keeping what is already encoded; the row stores that valid string. If it still cannot be read and contains an@, the message says to percent-encode special characters (@is%40, ...)./X:/or/X:\path loses the URI's slash.MongoConnection.buildConnectionUribrackets it in the URI it writes.Tests: four raw-password URLs (host, password, database, valid stored string), an encoded password stays encoded once, the encoding hint (and the plain message without an
@), the Windows path and an unchanged POSIX path, the IPv6 name.