We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 387afd1 + 735b806 commit 1012111Copy full SHA for 1012111
1 file changed
lib/models/note.js
@@ -211,6 +211,15 @@ module.exports = function (sequelize, DataTypes) {
211
},
212
// parse note id by LZString is deprecated, here for compability
213
parseNoteIdByLZString: function (_callback) {
214
+ // Calculate minimal string length for an UUID that is encoded
215
+ // base64 encoded and optimize comparsion by using -1
216
+ // this should make a lot of LZ-String parsing errors obsolete
217
+ // as we can assume that a nodeId that is 48 chars or longer is a
218
+ // noteID.
219
+ const base64UuidLength = ((4 * 36) / 3) - 1
220
+ if (!(noteId.length > base64UuidLength)) {
221
+ return _callback(null, null)
222
+ }
223
// try to parse note id by LZString Base64
224
try {
225
var id = LZString.decompressFromBase64(noteId)
0 commit comments