Skip to content

Commit d5d2671

Browse files
rodcoffaniglpatcern
authored andcommitted
Add docId when loading images
1 parent 2cdb572 commit d5d2671

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bridge/codimd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def getredirecturl(viewmode, wopisrc, acctok, docid, filename, displayname, reva
7878
# Cloud storage to CodiMD
7979
##########################
8080

81-
def _unzipattachments(inputbuf, wopisrc, acctok):
81+
def _unzipattachments(inputbuf, docid, wopisrc, acctok):
8282
'''Unzip the given input buffer uploading the content to CodiMD and return the contained .md file'''
8383
mddoc = None
8484
try:
@@ -108,6 +108,7 @@ def _unzipattachments(inputbuf, wopisrc, acctok):
108108
res = requests.post(appurl + '/uploadimage',
109109
params={'generateFilename': 'false',
110110
'WOPISrc': wopisrc,
111+
'docId': docid,
111112
'accessToken': acctok},
112113
files={'image': (fname, inputzip.read(zipinfo))}, verify=sslverify, timeout=10)
113114
if res.status_code != http.client.OK:
@@ -150,7 +151,7 @@ def loadfromstorage(filemd, wopisrc, acctok, docid):
150151

151152
# if it's a bundled file, unzip it and push the attachments in the appropriate folder
152153
if wasbundle and mdfile:
153-
mddoc = _unzipattachments(mdfile, wopisrc, acctok)
154+
mddoc = _unzipattachments(mdfile, docid, wopisrc, acctok)
154155
else:
155156
mddoc = mdfile
156157
# if the file was created on Windows, convert \r\n to \n for CodiMD to correctly edit it

0 commit comments

Comments
 (0)