Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML 解析时属性值带空格报错 #153

Closed
shuzijun opened this issue Aug 13, 2021 · 0 comments
Closed

HTML 解析时属性值带空格报错 #153

shuzijun opened this issue Aug 13, 2021 · 0 comments
Assignees

Comments

@shuzijun
Copy link
Contributor

shuzijun commented Aug 13, 2021

描述问题 Describe the problem

解析html异常,当img的src属性带有空格时提示异常

例如html

<img src=" https://camo.githubusercontent.com/497f6a6416dc9701a219f440ad8239c90a4aa1e56272679dbe6e37f1c15028f1/68747470733a2f2f62336c6f672e6f72672f696d616765732f6272616e642f6c7574652d3132382e706e67" style="height:250px; width:250px"/>

粘贴到javascript/lute.html的文本框中,不能正常展示图片,控制台异常

lute.min.js:4 Uncaught Error: runtime error: slice bounds out of range
    at $callDeferred (lute.min.js:4)
    at $panic (lute.min.js:4)
    at AR (runtime.go:380)
    at $subslice (lute.min.js:4)
    at Object.$packages.github.com/88250/lute/parse.BS.ptr.isOpenTag (html_block.go:277)
    at Object.$packages.github.com/88250/lute/parse.BS.ptr.parseHTML (html_block.go:168)
    at AK (html_block.go:37)
    at Object.$packages.github.com/88250/lute/parse.BS.ptr.incorporateLine (blocks.go:162)
    at Object.$packages.github.com/88250/lute/parse.BS.ptr.parseBlocks (blocks.go:39)
    at Object.BN [as Parse] (parse.go:32)
    at Object.$packages.github.com/88250/lute.N.ptr.Markdown (lute.go:80)
    at Object.$packages.github.com/88250/lute.N.ptr.MarkdownStr (lute.go:91)
    at Object.e.$externalizeWrapper.e.$externalizeWrapper (lute.min.js:4)
    at js.go:144
    at Object.e.$externalizeWrapper.e.$externalizeWrapper [as MarkdownStr] (lute.min.js:4)
    at onMarkdown (lute.html:36)
    at HTMLTextAreaElement.oninput (lute.html:44)

期待的结果 Expected result

在可以正常解析

截屏或录像 Screenshot or video

版本环境 Version environment

  • 版本 Version:0.30
  • 操作系统 Operating system: windows
  • 浏览器(如果使用)Browser (if used):chrome

其他信息 Other information

@88250 88250 self-assigned this Aug 13, 2021
@88250 88250 changed the title runtime error: slice bounds out of range HTML 解析时属性值带空格报错 Aug 13, 2021
@88250 88250 closed this as completed in 01217a3 Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants