hectorqin / reader

阅读3服务器版,桌面端,iOS可用。后端 Kotlin + Spring Boot + Vert.x + Coroutine ;前端 Vue.js + Element。麻烦点点star,关注一下公众号【假装大佬】❗️ Demo服务器由于未备案已被关停,建议自行搭建
GNU General Public License v3.0
7.79k stars 5.17k forks source link

assets 绝对路径引用导致 书架设置>导入书籍 报错 #472

Closed greatbody closed 8 months ago

greatbody commented 8 months ago

为避免无效问题和冗余问题,提问前请确认

  1. 你确定Google不能解决你的问题
  2. 你确定已有的issue不能解决你的问题
  3. 你确定issue的title按照格式如下:[web/simple-web/server]:description

Describe the bug 描述你遇到的问题 上传 UMD文件到书架失败。 To Reproduce 如何重现问题

  1. Go to '书架设置,导入书籍'
  2. 选择 umd 文件,上传
  3. See error java.io.FileNotFoundException: /assets/admin/book/喻世明言.umd (No such file or directory)

Expected behavior 期待修复的效果 正常展示书籍。不报错。

别的不说了,直接说出问题的地方

src/main/java/io/legado/app/model/localBook/UmdFile.kt 文件中

    private fun readUmd(): UmdBook? {
        val input = File(book.bookUrl).inputStream()
        return UmdReader().read(input)
    }

book.bookUrl 看起来是给前端加载显示用的路径,拼接的是 '/assets/[user]/book/[bookfile]' 但是确误用了这个来读文件,导致加载失败。

对 kotlin 不熟悉,麻烦请修复。

greatbody commented 8 months ago

@hectorqin 大佬终于出现了,求修改。因为这个项目大佬现在是半开源,所以不清楚怎么改才能整个流程跑通,所以就没敢下手改。只粗略定位了一下似乎出 bug 的地方,还请海涵。

hectorqin commented 8 months ago

不错,应该就是这里,我周末看看有没有时间修复吧

greatbody commented 8 months ago

不错,应该就是这里,我周末看看有没有时间修复吧

@hectorqin 大佬记得来修哈

hectorqin commented 8 months ago

新版本已修复