Opened 7 years ago

Last modified 5 years ago

#4166 reopened defect

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

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

Description

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 (5)

comment:1 Changed 7 years ago by TomH

  • Owner changed from rails-dev@… to zerebubuth@…
  • Status changed from new to assigned

comment:2 Changed 7 years ago by Matt

  • Owner changed from zerebubuth@… to Matt
  • Status changed from assigned to accepted

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 7 years ago by Koying

  • Resolution set to invalid
  • Status changed from accepted to closed

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

Sorry for the noise.

comment:4 Changed 6 years ago by fkv

  • Resolution invalid deleted
  • Status changed from closed to reopened

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 5 years ago by don-vip

  • Milestone set to OSM 0.6
  • Priority changed from major to minor
Note: See TracTickets for help on using tickets.