laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
45.93k stars 4.99k forks source link

backslash(es) in markdown code let joplin freeze (forever) #5245

Closed chrismade closed 3 years ago

chrismade commented 3 years ago

Environment

Joplin version: Joplin 2.1.9 (prod, win32) - happened also on earlier version (but I was not able to deliver repro instructions) Platform: win32 OS specifics:

Client ID: 9803ea6e019c41fc90ce229638d50153 Sync Version: 2 Profile Version: 39 Keychain Supported: No

Revision: 882d66383

Steps to reproduce

  1. take a text like this D:\daten\muell>dir \s\b D:\daten\muell\boot.img D:\daten\muell\dtbo.img D:\daten\muell\install D:\daten\muell\META-INF D:\daten\muell\system.new.dat.br D:\daten\muell\system.patch.dat D:\daten\muell\system.transfer.list D:\daten\muell\vbmeta.img

  2. open any note - switch into markdown editor and find (or create a code block - using the 3 backticks ) or doubleclick on an existing code in RTF editor which open the code editor try to insert with copy/paste the text from [1] or likely any other text that contains backslash like the text from [1]

  3. Joplin freezes immediately - reboot does not help - Joplin freezes on open - only remedy is to remove folder "JoplinProfile" and start re-sync (if you are lucky to have your notes synced somewhere - nextcloud in my case)

Describe what you expected to happen

expected to insert this text like any other text on paste -

if I replace all backslash by regular slash everything works as expected - text is inserted, no freeze

Logfile

I have the logfiles but it seems these do not contain any useful info regarding this issue as freeze happens immediately - of course I will upload logfile on request but instructions above should help to repro the case even without logfile

laurent22 commented 3 years ago

I cannot replicate this issue. Any chance you could switch to safe mode (Under Help menu), then right-click on the note and export as JEX? That way we'll have the exact note to replicate the issue.

chrismade commented 3 years ago

@laurent22 - I agree the procedure above cannot repro the issue - but thanks to your instructions I created a note in "safe" mode, exported as JEX - and the moment I toggle from "safe" to "regular" it freezes - 07_08_2021.txt

file renamed from JEX to TXT - can you repro the issue with that file ?

roman-r-m commented 3 years ago

I can reproduce it with your file This is coming from highlight.js, looks very similar to this issue https://github.com/highlightjs/highlight.js/issues/2375 although that exact bug is fixed in the version Joplin is using.

roman-r-m commented 3 years ago

Upgrading highlight.js to the latest version fixes it.

chrismade commented 3 years ago

wow I deeply impressed - I guess that's something which comes with the exe file and I can't fix it myself, right ? btw - Joplin is an excellent tool, OneNote is now history for me (still need to convert a few hundred notes) - pls keep up the good work!

roman-r-m commented 3 years ago

wow I deeply impressed - I guess that's something which comes with the exe file and I can't fix it myself, right ?

i think setting language explicitly would help in this particular case. something like

```bat

...
laurent22 commented 3 years ago

@roman-r-m, do you have a working version of it? And if so, any chance you could create a PR with it?

roman-r-m commented 3 years ago

Sure: https://github.com/laurent22/joplin/pull/5278

I haven't tested it much, only verified that the above attached file no longer causes Joplin to freeze + a few basic checks.