Fix: web书架读书章节内容存在多张图片时代理图片url中的bookUrl参数未encodeURIComponent导致的图片无法访问
感谢:@PanicNotPanic、@Panic° Co-authored-by: 17683954109@163.com <17683954109@163.com>
This commit is contained in:
@@ -305,6 +305,12 @@ const getContent = (index: number, reloadChapter = true, chapterPos = 0) => {
|
|||||||
if (res.data.isSuccess) {
|
if (res.data.isSuccess) {
|
||||||
const data = res.data.data
|
const data = res.data.data
|
||||||
const content = data.split(/\n+/)
|
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 })
|
chapterData.value.push({ index, content, title })
|
||||||
if (reloadChapter) toChapterPos(chapterPos)
|
if (reloadChapter) toChapterPos(chapterPos)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user