Skip to content

Commit

Permalink
Added a temporary patch to compensate the reverse proxy path used at …
Browse files Browse the repository at this point in the history
…CERN
  • Loading branch information
glpatcern committed Jul 11, 2022
1 parent 25dd7ce commit 2bf00ed
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bridge/codimd.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _unzipattachments(inputbuf):
fname = zipinfo.filename
log.debug('msg="Extracting attachment" name="%s"' % fname)
if os.path.splitext(fname)[1] == '.md':
mddoc = inputzip.read(zipinfo)
mddoc = inputzip.read(zipinfo).decode()
else:
# first check if the file already exists in CodiMD:
res = requests.head(appurl + '/uploads/' + fname, verify=sslverify)
Expand All @@ -107,7 +107,10 @@ def _unzipattachments(inputbuf):
files={'image': (fname, inputzip.read(zipinfo))}, verify=sslverify)
if res.status_code != http.client.OK:
log.error('msg="Failed to push included file" filename="%s" httpcode="%d"' % (fname, res.status_code))
return mddoc
if mddoc:
# for backwards compatibility, drop the hardcoded reverse proxy paths if found in the document
mddoc = mddoc.replace('/byoa/codimd/', '/')
return mddoc.encode()


def _isslides(doc):
Expand Down

0 comments on commit 2bf00ed

Please sign in to comment.