Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

500 error from api when uploading a tag with value ending with "%" (percent) #4166

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 4 comments

Comments

@openstreetmap-trac
Copy link

Reporter: Koying
[Submitted to the original trac issue database at 12.54am, Thursday, 29th December 2011]

The api returns a 500 error when trying to upload a diff change with a tag value ending with a percent.

A tag value with a percent in the middle works fine.

Example osmchange:[[BR]]

<?xml version="1.0" encoding="UTF-8"?><osmChange  version="0.3" generator="Merkaartor 0.18"><create><node id="-1" timestamp="2011-12-30T16:15:37Z" version="0" user="" lon="3.5325143" lat="54.1949722"><tag k="Test" v="15%"/></node></create></osmChange >```
@openstreetmap-trac
Copy link
Author

Author: Matt
[Added to the original trac issue at 9.24pm, Friday, 30th December 2011]

It seems that this might be due to a lack of Content-Type header on the request. When this isn't present, Rails seems to assume it's application/x-www-form-urlencoded, which is a reasonable default for web middleware and RFC compliant. However, this means it would attempt to interpret the '%' as an escape code and fail whenever it's not followed by two hex digits.

It appears to work as expected when the Content-Type is set to "text/xml" in my tests.

It's possible this isn't the same issue as you're seeing. If this is the case, and a Content-Type header is being sent, please could you provide a tcpdump of the failing session for further analysis?

@openstreetmap-trac
Copy link
Author

Author: Koying
[Added to the original trac issue at 2.59am, Saturday, 31st December 2011]

I confirm setting the Content-Type to text/xml solves the problem.

Sorry for the noise.

@openstreetmap-trac
Copy link
Author

Author: fkv
[Added to the original trac issue at 6.20am, Sunday, 22nd April 2012]

This should cause a 4xx error, not a 500. An internal server error is always a serious bug, no matter whether the request was valid or not.

This issue affects a lot of users, because I get it with Markaartor (latest stable version), which is one of the major Openstreetmap editors. There may be a bug in Merkaartor too, but anyway the internal server error is a server bug.

@openstreetmap-trac
Copy link
Author

Author: mmd
[Added to the original trac issue at 6.05pm, Tuesday, 19th May 2020]

I'm getting a HTTP 400 when using Content-Type application/x-www-form-urlencoded

When using application/xml, everything works ok.

Closing here, as the reported HTTP 500 no longer occurs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant