From ce2ca348cc7be6baa909ce95ae98575c2776c58c Mon Sep 17 00:00:00 2001 From: Giuseppe Lo Presti Date: Wed, 3 Apr 2024 12:49:58 +0200 Subject: [PATCH] codimd: fixed import of md files created on Windows platforms --- src/bridge/codimd.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bridge/codimd.py b/src/bridge/codimd.py index a9b0f86d..f6f95009 100644 --- a/src/bridge/codimd.py +++ b/src/bridge/codimd.py @@ -147,6 +147,10 @@ def loadfromstorage(filemd, wopisrc, acctok, docid): mddoc = _unzipattachments(mdfile) else: mddoc = mdfile + # if the file was created on Windows, convert \r\n to \n for CodiMD to correctly edit it + if mddoc.find(b'\r\n') >= 0: + mddoc = mddoc.replace(b'\r\n', b'\n') + try: if not docid: # read-only case: push the doc to a newly generated note with a random docid