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

Escape image in case of url String #21

Conversation

RubenTeixeira
Copy link

No description provided.

@diogotcorreia
Copy link

@freearhey Hey, could this be reviewed when you have the time? Thank you for your work!
Just pinging in case you missed this PR.

Some more context for the PR:
This tool is apparently not correctly escaping URLs for images, so if an image contains an &, an XML parser will expect it to be an XML entity instead and fail when it encounters the =.

Example:

<programme start="20241106223500 +0000" stop="20241107011500 +0000" channel="Lorem Ipsum"><title lang="en">Lorem Ipsum</title><image>https://example.com/example?foo=foo&bar=bar</image></programme>
System.Xml.XmlException: '=' is an unexpected token. The expected token is ';'. Line 164, position 299

@diogotcorreia
Copy link

@RubenTeixeira Taking a further look at your patch, I think you should change change this line to call escapeString like the rest of the code:

[image.value]

e.g.

[escapeString(image.value)]

And since you're at it, do the same for createURLElement.

It's probably a good idea to update the tests as well: https://github.com/freearhey/epg-grabber/blob/5494988b3674508c51ffcdae76de4034ac79ef7d/tests/xmltv.test.js

Let me know if you want me to open another PR instead, in case you're busy.

@freearhey
Copy link
Owner

Fixed in v0.37.2.

@freearhey freearhey closed this Nov 8, 2024
@diogotcorreia
Copy link

@freearhey any chance of updating this in https://github.com/iptv-org/epg? Thanks in advance

diogotcorreia added a commit to diogotcorreia/iptv-org-epg that referenced this pull request Nov 25, 2024
This fixes an issue with image URLs not being escaped and therefore
resulting in invalid XML.

See freearhey/epg-grabber#21
tohenk pushed a commit to iptv-org/epg that referenced this pull request Dec 2, 2024
This fixes an issue with image URLs not being escaped and therefore
resulting in invalid XML.

See freearhey/epg-grabber#21
tohenk pushed a commit to iptv-org/epg that referenced this pull request Dec 2, 2024
This fixes an issue with image URLs not being escaped and therefore
resulting in invalid XML.

See freearhey/epg-grabber#21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants