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

XML parsing fault when using the <=> operator in maniascript #29

Open
snixtho opened this issue Jul 21, 2023 · 5 comments
Open

XML parsing fault when using the <=> operator in maniascript #29

snixtho opened this issue Jul 21, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@snixtho
Copy link
Member

snixtho commented Jul 21, 2023

It appears that the script tags after rendering is not surrounded by a comment. So when you use characters such as < and > it will return a fault as the server fails to parser the XML. For example, when using the <=> operator, it fails.

@snixtho snixtho added the bug Something isn't working label Jul 21, 2023
@kdankert
Copy link
Member

kdankert commented Jul 24, 2023

It fails parsing the file when using < or >, but this is a limitation of the xml spec, which does not allow these characters inside of attribute values. Right now, xml escape characters have to be used. < and > should be replaced by < and > respectively.

@kdankert
Copy link
Member

If we want to allow the characters inside of values, we will probably need a different xml parser or do some preprocessing before parsing the file, replacing those characters by their escape sequences.

@snixtho
Copy link
Member Author

snixtho commented Jul 24, 2023

We just need to put the maniascript inside a comment, then it works. The template engine can do this automatically.

@kdankert
Copy link
Member

kdankert commented Jul 26, 2023

Then we are talking about different things.

But doesn't this already cause an issue when trying to compile an template which has <script>a <=> b</script> in it?

You might want to use < or > in condition blocks as well, which causes this issue as well. That's is why we are using escape sequences currently.

<Label if="i &lt; numbers.Count" foreach="int j in numbers.GetRange(0, i)" text="{{ i }}, {{ j }} at index {{ __index }}, {{ __index2 }}"/>

@snixtho
Copy link
Member Author

snixtho commented Jul 26, 2023

Then we are talking about different things.

But doesn't this already cause an issue when trying to compile an template which has <script>a <=> b</script> in it?

You might want to use < or > in condition blocks as well, which causes this issue as well. That's is why we are using escape sequences currently.

<Label if="i &lt; numbers.Count" foreach="int j in numbers.GetRange(0, i)" text="{{ i }}, {{ j }} at index {{ __index }}, {{ __index2 }}"/>

The error im talking about happens on the game server, not in the engine. And things like <> is already escaped by the engine in attributes afaik.

The common technique for Maniascript is to essentially put it inside an XML comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants