Opened 9 years ago

Closed 3 months ago

#4166 closed defect (invalid)

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

Reported by: Chris Browet Owned by: Matt
Priority: minor Milestone: OSM 0.6
Component: api Version:
Keywords: Cc:


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:

<?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 >}}}

Change History (6)

comment:1 Changed 9 years ago by Tom Hughes

Owner: changed from rails-dev@… to zerebubuth@…
Status: newassigned

comment:2 Changed 9 years ago by Matt

Owner: changed from zerebubuth@… to Matt
Status: assignedaccepted

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?

comment:3 Changed 9 years ago by Chris Browet

Resolution: invalid
Status: acceptedclosed

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

Sorry for the noise.

comment:4 Changed 8 years ago by fkv

Resolution: invalid
Status: closedreopened

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.

comment:5 Changed 6 years ago by don-vip

Milestone: OSM 0.6
Priority: majorminor

comment:6 Changed 3 months ago by mmd

Resolution: invalid
Status: reopenedclosed

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.

Note: See TracTickets for help on using tickets.