fix: handle undefined pathname in URL builder#2021
fix: handle undefined pathname in URL builder#2021UnschooledGamer wants to merge 11 commits intoAcode-Foundation:mainfrom
Conversation
Return early when pathname is undefined to avoid inserting an extra ':' and strip a leading '/' from newDocId before concatenation
|
Oh no, biome didn't complain locally. We'll be fixed before merging |
Greptile SummaryThis PR adds an early-return guard in Confidence Score: 5/5Safe to merge; the fix is logically correct and the only remaining finding is a test-coverage gap (P2). The undefined-pathname separator logic is correct across all four slash-presence combinations, prior P1 concerns from earlier review rounds have been addressed, and the single open finding is a P2 suggestion to add a test for the specific code path the fix introduces. src/test/url.tests.js — none of the new tests exercise the Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Url.join(...pathnames)"] --> B{protocol === 'content://'?}
B -- No --> C["path.join / protocol join"]
B -- Yes --> D["Strip leading '/' from pathnames[1]"]
D --> E["Uri.parse → rootUri, docId"]
E --> F["docId.split(':') → [root, pathname]"]
F --> G["newDocId = path.join(pathname, ...pathnames.slice(1))"]
G --> H{Termux URL?}
H -- Yes --> I["Normalize root/newDocId separators\nReturn rootUri::root+newDocId"]
H -- No --> J{"pathname undefined?\n(!pathname)"}
J -- Yes --> K["Normalize separator between\nroot and newDocId"]
K --> L["Return rootUri::root+separator+newDocId\n(no extra ':')"]
J -- No --> M["Return rootUri::root:newDocId"]
Reviews (5): Last reviewed commit: "Merge branch 'fix/url-no-doc-id' of http..." | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Move pathname handling into the correct branch and ensure a ':' is inserted between root and newDocId when appropriate
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
|
The new tests do use Linting CI fails due to commits from upstream. |
Return early when pathname is undefined to avoid inserting an extra ':' and strip a leading '/' from newDocId before concatenation