Skip to content

Commit

Permalink
ADD Check to ensure that the primaryKey does not contain a double-quote
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Apr 10, 2023
1 parent 34da670 commit 512577f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# RxDB Changelog

<!-- CHANGELOG NEWEST -->

- ADD Check to ensure that the primaryKey does not contain a double-quote.
<!-- ADD new changes here! -->

<!-- /CHANGELOG NEWEST -->
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/dev-mode/check-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,13 @@ export function ensurePrimaryKeyValid(
document: docData
});
}
if (
primaryKey.includes('"')
) {
throw newRxError('DOC23', {
primaryKey,
document: docData
});
}
}

1 change: 1 addition & 0 deletions src/plugins/dev-mode/error-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const ERROR_MESSAGES = {
DOC20: 'PrimaryKey missing',
DOC21: 'PrimaryKey must be equal to PrimaryKey.trim(). It cannot start or end with a whitespace',
DOC22: 'PrimaryKey must not contain a linebreak',
DOC23: 'PrimaryKey must not contain a double-quote ["]',

// data-migrator.js
DM1: 'migrate() Migration has already run',
Expand Down

0 comments on commit 512577f

Please sign in to comment.