[OSM-dev] Unhelpful error on upload

Tom Hughes tom at compton.nu
Thu Jan 17 14:47:29 GMT 2008


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.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/




More information about the dev mailing list