File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,20 +31,14 @@ function getHistory (userid, callback) {
3131 history = JSON . parse ( user . history )
3232 // migrate LZString encoded note id to base64url encoded note id
3333 for ( let i = 0 , l = history . length ; i < l ; i ++ ) {
34- let item = history [ i ]
35- // try to parse in base64url
36- let id = models . Note . decodeNoteId ( item . id )
37- if ( ! id || ! models . Note . checkNoteIdValid ( id ) ) {
38- // try to parse in LZString if it can't be parsed in base64url
39- try {
40- id = LZString . decompressFromBase64 ( item . id )
41- } catch ( err ) {
42- id = null
43- }
34+ try {
35+ let id = LZString . decompressFromBase64 ( history [ i ] . id )
4436 if ( id && models . Note . checkNoteIdValid ( id ) ) {
45- // replace the note id to base64url encoded note id
4637 history [ i ] . id = models . Note . encodeNoteId ( id )
4738 }
39+ } catch ( err ) {
40+ // most error here comes from LZString, ignore
41+ logger . error ( err )
4842 }
4943 }
5044 history = parseHistoryToObject ( history )
You can’t perform that action at this time.
0 commit comments