Skip to content

Commit

Permalink
codimd: fixed import of md files created on Windows platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Apr 3, 2024
1 parent 43633d2 commit ce2ca34
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bridge/codimd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ce2ca34

Please sign in to comment.