Opened 10 years ago

Closed 10 years ago

#2487 closed defect (invalid)

XML parsing breaks using escapes

Reported by: stefan@… Owned by: zerebubuth@…
Priority: major Milestone:
Component: api Version:
Keywords: xml escape quote Cc:

Description

The following is send to the API <tag k='name' v='Lijn 31 van DEN HAAG naar NAALDWIJK via MONSTER en \'s-GRAVENZANDE' />

This comes back in the XML error: <tag k='name' v='Lijn 31 van DEN HAAG naar NAALDWIJK via MONSTER en 's-GRAVENZANDE' />

Escape chars shouldn't be ignored.

Change History (10)

comment:1 Changed 10 years ago by Tom Hughes

Can you clarify what the problem is? Are you saying that trying to upload that object results in an error? or that if you upload it and then download it again the backslash is lost?

comment:2 Changed 10 years ago by stefan@…

I am trying to upload an object including the first above tag. That object returns an XML error. And the XML error clearly shows that it has lost the escaping slash.

comment:3 Changed 10 years ago by stefan@…

...and to be totally clear. If I replace it with a "bla '" sequence it works.

comment:4 Changed 10 years ago by Tom Hughes

What does the error say exactly? Presumably it doesn't just quote the XML but has some sort of error message?

comment:5 Changed 10 years ago by stefan@…

Uploaded: <osm><relation changeset='1' version='1' id='1'><tag k='name' v='Lijn 31 van DEN HAAG naar NAALDWIJK via MONSTER en \'s-GRAVENZANDE' /></relation></osm>

Error: Cannot parse valid relation from xml string <osm><relation changeset='1' version='1' id='1'><tag k='name' v='Lijn 31 van DEN HAAG naar NAALDWIJK via MONSTER en \'s-GRAVENZANDE' /></relation></osm>

comment:6 Changed 10 years ago by stefan@…

Interesting now I see that the error that I made up actually has the \ so probably someone is working on it.

comment:7 Changed 10 years ago by Tom Hughes

Owner: changed from Tom Hughes to zerebubuth@…

Nobody is working on anything...

One for you I guess zere?

comment:8 Changed 10 years ago by stefan@…

Lets say I expect this difference is between a /create vs an update.

comment:9 Changed 10 years ago by Matt

i've tested the code for both create and update and, for me, they both return the same error message with the correct escaping. if you can still reproduce this difference, it would help us a lot if you could post a trace of the relevant parts of the server conversation (e.g: curl --trace).

i'm sure you already know this, but backslashes do not escape chars in XML attributes. instead to escape the single quote use &#x27;. the original error is due to the XML parser terminating on the minus sign after the single quote after the backslash, as this is an invalid character in that context.

comment:10 Changed 10 years ago by Matt

Resolution: invalid
Status: newclosed

closing because there doesn't seem to be a reproducible issue here.

Note: See TracTickets for help on using tickets.