getmango / Mango

Mango is a self-hosted manga server and web reader
https://getmango.app
MIT License
1.69k stars 118 forks source link

[Bug Report] `mango.attribute` does not work correctly with certain strings. #320

Closed Elastic1 closed 1 year ago

Elastic1 commented 2 years ago

Describe the bug mango.attribute does not work correctly with certain strings.

To Reproduce

var html = '<img src="data:image/svg+xml,<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 1 1 \'></svg>" data-src="https://example.com/1.jpg" class="size-full wp-image-105 aligncenter lazy image-vertical" alt="">'
var src = mango.attribute(html, 'data-src') // null (expected: https://example.com/1.jpg)

In my plugin, I currently deal with this by removing the src="..." Environment (please complete the following information):

hkalexling commented 2 years ago

Thanks for the bug report! mango.attribute uses an XML parser and it doesn't like the < and > characters in attribute values. I will replace it with a proper HTML parser and it should resolve the issue.

mango-assistant[bot] commented 1 year ago

Hi there! The issue has been fixed in v0.27.0. Thanks for the bug report!