TriliumNext / Notes

Build your personal knowledge base with TriliumNext Notes
GNU Affero General Public License v3.0
759 stars 41 forks source link

Import md with jpeg: broken jpeg #456

Open maphew opened 6 days ago

maphew commented 6 days ago

TriliumNext Version

0.90.4

What operating system are you using?

Windows

What is your setup?

Local + server sync

Operating System Version

win 11 pro (10.0.22631 N/A Build 22631)

Description

TriliumNext Build: 2024-08-09T22:05:59Z

Importing the attached zip with markdown file with linked jpeg results in a broken jpeg. Importing the jpeg on it's own is fine.

import options (accept defaults): import options (accept defaults)

Result in parent folder preview: result image

Result md node with broken image link: image In view Note Source the image is referenced as<img src="api/images/w26Wa5g7yCMy/tbird3-gmail-tab.jpg" alt="tbird3-gmail-tab.jpg" />

Result jpg node, shows as type text (image/jpeg). The ID# matches the img src above: image

Error logs

21:23:01.094 Sending message to all clients: {"type":"sync-finished","lastSyncedPush":39103} 21:23:20.889 Sending message to all clients: {"type":"taskProgressCount","taskId":"EFbdmuZ301","taskType":"importNotes","data":{"safeImport":true,"shrinkImages":true,"textImportedAsText":true,"codeImportedAsCode":true,"explodeArchives":true,"replaceUnderscoresWithSpaces":true},"progressCount":0} 21:23:20.907 Created new note 'ajpzxwxWwI1x', branch 'Pv63LJ4QTLbF_ajpzxwxWwI1x' of type 'text', mime 'text/markdown' 21:23:20.915 Created new note 'w26Wa5g7yCMy', branch 'Pv63LJ4QTLbF_w26Wa5g7yCMy' of type 'text', mime 'image/jpeg' 21:23:20.932 Becca (note cache) load took 15ms 21:23:20.932 Slow 200 POST /api/notes/Pv63LJ4QTLbF/notes-import with 354 bytes took 43ms 21:23:21.920 Sending message to all clients: {"type":"taskSucceeded","taskId":"EFbdmuZ301","taskType":"importNotes","data":{"safeImport":true,"shrinkImages":true,"textImportedAsText":true,"codeImportedAsCode":true,"explodeArchives":true,"replaceUnderscoresWithSpaces":true},"result":{"parentNoteId":"Pv63LJ4QTLbF","importedNoteId":"ajpzxwxWwI1x"}} 21:23:21.923 200 POST /api/tree/load with 8966 bytes took 1ms

maphew commented 6 days ago

this is a regression. Importing the same zip in Zadam Trilium is fine (using browser to connect to Trilium server, not electron desktop app).

Trilium Notes: v0.63.7 Build date: 2024-05-30T06:59:06+02:00

image

perfectra1n commented 5 days ago

Interesting, it looks like it's finding the correct MIME type for the import, but the Trilium "type" value is being incorrectly assigned when expanding the zip.