Skip to content

Commit

Permalink
pouchdb-find: make _design/ prefix removal more specific (#8946)
Browse files Browse the repository at this point in the history
Current code will match `_design/` anywhere.

I suspect it should only be replacing `_design/` when it's a prefix.
  • Loading branch information
alxndrsn committed May 9, 2024
1 parent 06170b6 commit 9c587a6
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function massageSort(sort) {
});
}

const ddocIdPrefix = /^_design\//;
function massageUseIndex(useIndex) {
let cleanedUseIndex = [];
if (typeof useIndex === 'string') {
Expand All @@ -27,7 +28,7 @@ function massageUseIndex(useIndex) {
}

return cleanedUseIndex.map(function (name) {
return name.replace('_design/', '');
return name.replace(ddocIdPrefix, '');
});
}

Expand Down

0 comments on commit 9c587a6

Please sign in to comment.