From d917f0e37dbd2dbc1ccc5730f3a8ab36351ec649 Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 30 Nov 2022 16:15:25 -0600 Subject: [PATCH] Fix:Ebook reader for ebooks in root folder #1232 --- client/components/readers/Reader.vue | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/client/components/readers/Reader.vue b/client/components/readers/Reader.vue index 290ac12a..a06f4f5b 100644 --- a/client/components/readers/Reader.vue +++ b/client/components/readers/Reader.vue @@ -92,13 +92,18 @@ export default { }, ebookUrl() { if (!this.ebookFile) return null - var itemRelPath = this.selectedLibraryItem.relPath - if (itemRelPath.startsWith('/')) itemRelPath = itemRelPath.slice(1) - var relPath = this.ebookFile.metadata.relPath - if (relPath.startsWith('/')) relPath = relPath.slice(1) + let filepath = '' + if (this.selectedLibraryItem.isFile) { + filepath = this.$encodeUriPath(this.ebookFile.metadata.filename) + } else { + const itemRelPath = this.selectedLibraryItem.relPath + if (itemRelPath.startsWith('/')) itemRelPath = itemRelPath.slice(1) + const relPath = this.ebookFile.metadata.relPath + if (relPath.startsWith('/')) relPath = relPath.slice(1) - const relRelPath = this.$encodeUriPath(`${itemRelPath}/${relPath}`) - return `/ebook/${this.libraryId}/${this.folderId}/${relRelPath}` + filepath = this.$encodeUriPath(`${itemRelPath}/${relPath}`) + } + return `/ebook/${this.libraryId}/${this.folderId}/${filepath}` }, userToken() { return this.$store.getters['user/getToken']