Fix: web书架读书章节内容存在多张图片时代理图片url中的bookUrl参数未encodeURIComponent导致的图片无法访问

感谢:@PanicNotPanic、@Panic°
Co-authored-by: 17683954109@163.com <17683954109@163.com>
This commit is contained in:
HapeLee
2025-09-01 01:59:29 +08:00
parent 3ae4e9a134
commit 701f2826b3
+6
View File
@@ -305,6 +305,12 @@ const getContent = (index: number, reloadChapter = true, chapterPos = 0) => {
if (res.data.isSuccess) {
const data = res.data.data
const content = data.split(/\n+/)
const urlEncodedBookUrl = encodeURIComponent(bookUrl)
for (let i = 0; i < content.length; i++) {
if (!/^\s*<img[^>]*src[^>]+>$/.test(content[i])) {
content[i] = content[i].replace(new RegExp('img src="', 'g'), `img src="/image?url=${urlEncodedBookUrl}&path=`);
}
}
chapterData.value.push({ index, content, title })
if (reloadChapter) toChapterPos(chapterPos)
} else {