[OSM-dev] Unhelpful error on upload

John McKerrell john at mckerrell.net
Thu Jan 17 15:07:45 GMT 2008


On 17 Jan 2008, at 14:47, Tom Hughes wrote:

> In message <fmnost$q1j$1 at ger.gmane.org>
>         Gervase Markham <gerv-gmane at gerv.net> wrote:
>
>> Tom Hughes wrote:
>>> It's not complaining about the file (it hasn't even looked at the
>>> contents of the file) but rather about the contents of the upload
>>> form. Specifially about the tags field - most likely you have put
>>> in a character it does not allow (/ ; , . and ? are not allowed)
>>
>> Aha. Given that many tagging implementations expect tags to be  
>> separated
>> with commas, would it be too much for the upload mechanism to  
>> strip out
>> commas rather than barfing on them?
>>
>> Also, perhaps:
>>
>> "The 'tags' field you wrote contains an invalid character"
>>
>> would be a better error message. For bonus points, give the  
>> contents of
>> the field and say which character was illegal.
>
> Um - it's all rails stuff basically. I just say:
>
>   validates_format_of :tag, :with => /^[^\/;.,?]*$/
>
> and rails does the rest... I can probably give it a custom
> message if I look at the doco.
>
validates_format_of :tag, :with => /^[^\/;.,?]*$/, :message => "may  
only contain basic letters or numbers"

I was reading that bit of the rails book yesterday :-)

John




More information about the dev mailing list