diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-02-16 12:11:14 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-02-16 12:32:37 +0300 |
commit | 6efabc8df85e4242c089c2d1e7ed17bf8ef931a9 (patch) | |
tree | ad9c043827ac3be0746a9231876dacc169e002d9 /src | |
parent | b6f8b52d6c7e43724d1d6e9540ee29ca742f7452 (diff) |
Fix opening pdf files in public folder shares
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/views/PDFView.vue | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/views/PDFView.vue b/src/views/PDFView.vue index 0849309..d74bcc4 100644 --- a/src/views/PDFView.vue +++ b/src/views/PDFView.vue @@ -40,6 +40,15 @@ export default { encodedDavPath() { const hasScheme = this.davPath.indexOf('://') !== -1 + if (this.davPath.indexOf(generateUrl('/s/')) === 0) { + const host = window.location.protocol + '//' + window.location.host + const url = new URL(hasScheme ? this.davPath : host + this.davPath) + const path = this.filename.replace(this.basename, '') + url.searchParams.set('path', path) + url.searchParams.set('files', this.basename) + return hasScheme ? url.toString() : url.toString().substr(host.length) + } + const pathSections = this.davPath.split('/') // Ignore scheme and domain in the loop (note that the scheme |