mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	fix exporting huge text notes (export would get stuck on HTML pretty printing)
This commit is contained in:
		| @@ -13,6 +13,7 @@ const fs = require("fs"); | |||||||
| const becca = require("../../becca/becca"); | const becca = require("../../becca/becca"); | ||||||
| const RESOURCE_DIR = require('../../services/resource_dir').RESOURCE_DIR; | const RESOURCE_DIR = require('../../services/resource_dir').RESOURCE_DIR; | ||||||
| const archiver = require('archiver'); | const archiver = require('archiver'); | ||||||
|  | const log = require("../log"); | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @param {TaskContext} taskContext |  * @param {TaskContext} taskContext | ||||||
| @@ -54,7 +55,7 @@ function exportToZip(taskContext, branch, format, res) { | |||||||
|  |  | ||||||
|         let existingExtension = path.extname(fileName).toLowerCase(); |         let existingExtension = path.extname(fileName).toLowerCase(); | ||||||
|         let newExtension; |         let newExtension; | ||||||
|          |  | ||||||
|         if (fileName.length > 30) { |         if (fileName.length > 30) { | ||||||
|             fileName = fileName.substr(0, 30); |             fileName = fileName.substr(0, 30); | ||||||
|         } |         } | ||||||
| @@ -254,7 +255,9 @@ ${content} | |||||||
| </html>`; | </html>`; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             return html.prettyPrint(content, {indent_size: 2}); |             return content.length < 100000 | ||||||
|  |                 ? html.prettyPrint(content, {indent_size: 2}) | ||||||
|  |                 : content; | ||||||
|         } |         } | ||||||
|         else if (noteMeta.format === 'markdown') { |         else if (noteMeta.format === 'markdown') { | ||||||
|             let markdownContent = mdService.toMarkdown(content); |             let markdownContent = mdService.toMarkdown(content); | ||||||
| @@ -274,6 +277,8 @@ ${content} | |||||||
|     const notePaths = {}; |     const notePaths = {}; | ||||||
|  |  | ||||||
|     function saveNote(noteMeta, filePathPrefix) { |     function saveNote(noteMeta, filePathPrefix) { | ||||||
|  |         log.info(`Exporting note ${noteMeta.noteId}`); | ||||||
|  |  | ||||||
|         if (noteMeta.isClone) { |         if (noteMeta.isClone) { | ||||||
|             const targetUrl = getTargetUrl(noteMeta.noteId, noteMeta); |             const targetUrl = getTargetUrl(noteMeta.noteId, noteMeta); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user