Skip to content

Commit beda83d

Browse files
fix: handle undefined pathname in URL builder
Return early when pathname is undefined to avoid inserting an extra ':' and strip a leading '/' from newDocId before concatenation
1 parent 1d027dd commit beda83d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/utils/Url.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ export default {
8585
} else if (!rootCondition === !newDocIdCondition) {
8686
root += "/";
8787
}
88+
// if pathname is undefined, meaning a docId/volume (e.g :primary:)
89+
// has not been detected, so no newDocId's ":" will be added.
90+
if(!pathname) return `${contentUri.rootUri}::${root}${newDocId.startsWith("/") ? newDocId.slice(1) : newDocId}${query}`
8891
return `${contentUri.rootUri}::${root}${newDocId}${query}`;
8992
}
9093
return `${contentUri.rootUri}::${root}:${newDocId}${query}`;

0 commit comments

Comments
 (0)