mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	fix setting contentLength
This commit is contained in:
		
							parent
							
								
									6d276582cb
								
							
						
					
					
						commit
						4fdea77c57
					
				| @ -123,9 +123,11 @@ class Note extends Entity { | |||||||
|             throw new Error(`Cannot set null content to note ${this.noteId}`); |             throw new Error(`Cannot set null content to note ${this.noteId}`); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         content = Buffer.isBuffer(content) ? content : Buffer.from(content); | ||||||
|  | 
 | ||||||
|         // force updating note itself so that dateModified is represented correctly even for the content
 |         // force updating note itself so that dateModified is represented correctly even for the content
 | ||||||
|         this.forcedChange = true; |         this.forcedChange = true; | ||||||
|         this.contentLength = content.length; |         this.contentLength = content.byteLength; | ||||||
|         await this.save(); |         await this.save(); | ||||||
| 
 | 
 | ||||||
|         this.content = content; |         this.content = content; | ||||||
| @ -134,7 +136,7 @@ class Note extends Entity { | |||||||
|             noteId: this.noteId, |             noteId: this.noteId, | ||||||
|             content: content, |             content: content, | ||||||
|             utcDateModified: dateUtils.utcNowDateTime(), |             utcDateModified: dateUtils.utcNowDateTime(), | ||||||
|             hash: utils.hash(this.noteId + "|" + content) |             hash: utils.hash(this.noteId + "|" + content.toString()) | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|         if (this.isProtected) { |         if (this.isProtected) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam