diff --git a/src/core/commoniface.py b/src/core/commoniface.py index 9a4a7ce0..6eeffaea 100644 --- a/src/core/commoniface.py +++ b/src/core/commoniface.py @@ -81,7 +81,8 @@ def retrieverevalock(rawlock): def encodeinode(endpoint, inode): '''Encodes a given endpoint and inode to be used as a safe WOPISrc: endpoint is assumed to already be URL safe. - Note that the separator is chosen to be `!` for compatibility with the ownCloud Web frontend.''' + Note that the separator is chosen to be `!` (similar to how the web frontend is implemented) to allow the inverse + operation, assuming that `endpoint` does not contain any `!` characters.''' return endpoint + '!' + urlsafe_b64encode(inode.encode()).decode() diff --git a/src/core/wopiutils.py b/src/core/wopiutils.py index 63bc3c5b..1b4a45cf 100644 --- a/src/core/wopiutils.py +++ b/src/core/wopiutils.py @@ -147,9 +147,10 @@ def generateWopiSrc(fileid, proxy=False): def generateUrlFromTemplate(url, acctok): - '''One-liner to parse an URL template and return it with actualised placeholders. See also common.encodeinode()''' + '''One-liner to parse an URL template and return it with actualised placeholders. See also common.encodeinode().''' return url.replace('', url_quote_plus(acctok['filename'])). \ - replace('', acctok['endpoint'] + '!' + acctok['fileid']). \ + replace('', acctok['endpoint']). \ + replace('', acctok['fileid']). \ replace('', acctok['appname']) diff --git a/wopiserver.conf b/wopiserver.conf index b1acd908..ce93254b 100644 --- a/wopiserver.conf +++ b/wopiserver.conf @@ -44,19 +44,20 @@ loghandler = file # Optional URL to display a file sharing dialog. This enables # a 'Share' button within the application. The URL may contain -# the ``, ``, and `` placeholders, which are -# dynamically replaced with actual values for the opened file. -#filesharingurl = https://your-efss-server.org/fileshare?filepath=&app=&resource= +# any of the ``, ``, ``, and `` +# placeholders, which are dynamically replaced with actual values +# for the opened file. +#filesharingurl = https://your-efss-server.org/fileshare?filepath=&app=&fileId=! # URLs for the pages that embed the application in edit mode and # preview mode. By default, the appediturl and appviewurl are used, # but it is recommended to configure here a URL that displays apps # within an iframe on your EFSS. -# Placeholders ``, ``, and `` are dynamically -# replaced similarly to the above. The suggested example reflects -# the ownCloud web implementation. -#hostediturl = https://your-efss-server.org/external/spaces?app=&fileId= -#hostviewurl = https://your-efss-server.org/external/spaces?app=&fileId=&viewmode=VIEW_MODE_PREVIEW +# Placeholders ``, ``, ``, and `` are +# dynamically replaced similarly to the above. The suggested example +# reflects the ownCloud web implementation. +#hostediturl = https://your-efss-server.org/external/spaces?app=&fileId=! +#hostviewurl = https://your-efss-server.org/external/spaces?app=&fileId=!&viewmode=VIEW_MODE_PREVIEW # Optional URL prefix for WebDAV access to the files. This enables # a 'Edit in Desktop client' action on Windows-based clients