refactor: replace url-parse to WHATWG URL API#2244
Conversation
Greptile SummaryThis PR removes the third-party
Confidence Score: 3/5The refactor is conceptually sound, but the switch from a lenient URL parser to a strict-throwing one introduces unhandled exception paths in Two call sites — src/utils/Url.js (hidePassword and decodeUrl) and src/lib/remoteStorage.js (edit) need error handling around the new URL() constructor calls. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Stored URL string] --> B{Valid URL?}
B -- "Yes (url-parse & new URL)" --> C[Parse username / password / hostname / port / searchParams]
B -- "No - url-parse" --> D[Return empty-field object\n– graceful degradation]
B -- "No - new URL()" --> E[throws TypeError\n– unhandled exception ⚠️]
C --> F[decodeURIComponent on each field]
F --> G[Return parsed object to caller\nSftp.fromUrl / Ftp.fromUrl / edit / fileBrowser]
|
|
WHATWG URL will throws on invalid input but url-parse not, maybe We should add exception handler? |
In
url-parsereadme:So I think if We can do this for now :)