Open zhaoterryy opened 6 years ago
Seeing the same Issue on win10. Does moving svg to external files help?
Same issue on Win10.
Same issues on win10 - had to kill netstat task by force to reload live server again.
Am currently encountering this on VS Code Version 1.32.1 (1.32.1) on MacOS in Firefox, Chrome and Safari. Only 3 of the 5 SVGs show up and the extension crashes silently.
Confirmed on 1.32.3. If we reference SVG files with
As indicated by others, the issue appears due to multiple attempts by live-server to inject the client-side javascript code. The defect is around the matching and/or processing of those matches of injection candidates.
The current injection candidates are based on regular expression matches (new RegExp("</svg>")
). The simplest way to resolve this particular issue may be to make the regex a bit smarter by having it match only the last occurrence of </svg>
in the contents being served.
A proof-of-concept is outlined in the link below based on a convoluted-looking expression of <\/svg>(?![\s\S]*<\/svg>)
Sample SVG File with Nest SVG Elements nested.svg
Fix Proof-of-Concept https://regexr.com/4elgb
Location of Issue in Live Server Code https://github.com/ritwickdey/vscode-live-server/blob/d7c4d49ae236004e0e57041ddfe91e884b528bb2/lib/live-server/index.js#L60-L104
this issue y should change live-server to static-server ( on npm ). Because underhood live-server have st so, SVG it not work.
can you says how to fix it
did you fix it guys?
I'm submitting a...
Behavior
Inserting multiple inline SVGs gives a broken HTML page due to code injection from live-server being cutoff.
expected injection (first SVG):
resulting injection (after the 1st SVG):
Environment
Other
Same issue: https://github.com/tapio/live-server/issues/272