Skip to content

Commit 9c587a6

Browse files
authored
pouchdb-find: make _design/ prefix removal more specific (#8946)
Current code will match `_design/` anywhere. I suspect it should only be replacing `_design/` when it's a prefix.
1 parent 06170b6 commit 9c587a6

File tree

1 file changed

+2
-1
lines changed
  • packages/node_modules/pouchdb-find/src/adapters/local

1 file changed

+2
-1
lines changed

packages/node_modules/pouchdb-find/src/adapters/local/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ function massageSort(sort) {
1818
});
1919
}
2020

21+
const ddocIdPrefix = /^_design\//;
2122
function massageUseIndex(useIndex) {
2223
let cleanedUseIndex = [];
2324
if (typeof useIndex === 'string') {
@@ -27,7 +28,7 @@ function massageUseIndex(useIndex) {
2728
}
2829

2930
return cleanedUseIndex.map(function (name) {
30-
return name.replace('_design/', '');
31+
return name.replace(ddocIdPrefix, '');
3132
});
3233
}
3334

0 commit comments

Comments
 (0)