Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_pdfviewer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobbert Gurdeep Singh <git@beardhatcode.be>2021-05-21 22:11:09 +0300
committerRobbert Gurdeep Singh <git@beardhatcode.be>2021-05-21 22:19:00 +0300
commit6d81ffbb65c3758bece144e0aff07b4a0ad20eef (patch)
tree6ac86ce1dd80ebbffc71162602ead79d0b1ad46d /src
parent487c93f06b459d26f6eb09353eaa4ba1e05cf50b (diff)
Remove encodeURI code
The errors that required encodeURIComponent in the past have been mittigated by the following commit on nextcloud viewer. https://github.com/nextcloud/viewer/pull/868/commits/02e1b1a993fb24f577f16ac22f816b89c578acf2 The code with hasScheme may be removed, viewer now returns a full properly encoded URI thanks to the work done in nextcloud-router fixes #381 Signed-off-by: Robbert Gurdeep Singh <git@beardhatcode.be>
Diffstat (limited to 'src')
-rw-r--r--src/views/PDFView.vue34
1 files changed, 1 insertions, 33 deletions
diff --git a/src/views/PDFView.vue b/src/views/PDFView.vue
index d74bcc4..ac402f7 100644
--- a/src/views/PDFView.vue
+++ b/src/views/PDFView.vue
@@ -33,41 +33,9 @@ export default {
computed: {
iframeSrc() {
return generateUrl('/apps/files_pdfviewer/?file={file}', {
- file: this.encodedDavPath,
+ file: this.davPath,
})
},
-
- 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
- // delimiter, "//", creates an empty section when split by "/").
- const initialSection = hasScheme ? 3 : 0
-
- let encodedDavPath = ''
- for (let i = initialSection; i < pathSections.length; i++) {
- if (pathSections[i] !== '') {
- encodedDavPath += '/' + encodeURIComponent(pathSections[i])
- }
- }
-
- if (hasScheme) {
- encodedDavPath = pathSections[0] + '//' + pathSections[2] + encodedDavPath
- }
-
- return encodedDavPath
- },
},
async mounted() {