Fix parseNoteId order to fix some edge case
that LZString note url could be parsed by base64url note url and thus return wrong note id Signed-off-by: Max Wu <jackymaxj@gmail.com>
This commit is contained in:
		
							parent
							
								
									16cb842b94
								
							
						
					
					
						commit
						c7657ae81e
					
				@ -209,15 +209,6 @@ module.exports = function (sequelize, DataTypes) {
 | 
				
			|||||||
              return _callback(err, null)
 | 
					              return _callback(err, null)
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          parseNoteIdByBase64Url: function (_callback) {
 | 
					 | 
				
			||||||
            // try to parse note id by base64url
 | 
					 | 
				
			||||||
            try {
 | 
					 | 
				
			||||||
              var id = Note.decodeNoteId(noteId)
 | 
					 | 
				
			||||||
              if (id && Note.checkNoteIdValid(id)) { return callback(null, id) } else { return _callback(null, null) }
 | 
					 | 
				
			||||||
            } catch (err) {
 | 
					 | 
				
			||||||
              return _callback(err, null)
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          // parse note id by LZString is deprecated, here for compability
 | 
					          // parse note id by LZString is deprecated, here for compability
 | 
				
			||||||
          parseNoteIdByLZString: function (_callback) {
 | 
					          parseNoteIdByLZString: function (_callback) {
 | 
				
			||||||
            // try to parse note id by LZString Base64
 | 
					            // try to parse note id by LZString Base64
 | 
				
			||||||
@ -228,6 +219,15 @@ module.exports = function (sequelize, DataTypes) {
 | 
				
			|||||||
              return _callback(err, null)
 | 
					              return _callback(err, null)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
 | 
					          parseNoteIdByBase64Url: function (_callback) {
 | 
				
			||||||
 | 
					            // try to parse note id by base64url
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					              var id = Note.decodeNoteId(noteId)
 | 
				
			||||||
 | 
					              if (id && Note.checkNoteIdValid(id)) { return callback(null, id) } else { return _callback(null, null) }
 | 
				
			||||||
 | 
					            } catch (err) {
 | 
				
			||||||
 | 
					              return _callback(err, null)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
          parseNoteIdByShortId: function (_callback) {
 | 
					          parseNoteIdByShortId: function (_callback) {
 | 
				
			||||||
            // try to parse note id by shortId
 | 
					            // try to parse note id by shortId
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user