Opened 6 years ago

Closed 6 years ago

#4793 closed defect (fixed)

HTTP 500 error with Potlach editor

Reported by: metkos@… Owned by: rails-dev@…
Priority: major Milestone:
Component: website Version:
Keywords: 500 error serbian preffered language Cc:

Description

Using any component in OSM site is fine, but starting Potlach2 editor produce an HTTP 500 error:

Application error

The OpenStreetMap server encountered an unexpected condition that prevented it from fulfilling the request (HTTP 500)

Feel free to contact the OpenStreetMap community if your problem persists. Make a note of the exact URL / post data of your request.

This may be a problem in our Ruby On Rails code. 500 occurs with exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code)

I already found a cause. If I change "Preferred Languages" in OSM account settings and exclude serbian language (sr) - P2 starts normally.

I tried croatian (hr) and russian (ru) on first place in that field, they do not make problems. So to conclude, it is somehow connected to translations, serbian possibly.

People on IRC said that it is not connected to Potlach2, rather website itself.

Technical background:

auth = login or OpenID does not make a change;

browsers: tested with Firefox 19.x and Google Chrome;

OS: OpenSuse? 12.2 x64

Cheers!

M.

Change History (8)

comment:1 Changed 6 years ago by Tom Hughes

I've been unable to reproduce this so far, regardless of what I set my language settings to...

comment:2 Changed 6 years ago by emj

I can reproduce with language set to "sr", but only in potlatch2, with editor set to "potlatch1" it works nicely. On Linux, chrome 25 and FF.

When was this working for you last time?

Unrelated, this also throws application error: http://www.openstreetmap.org/edit?editor=RANDOMJUNK

comment:3 Changed 6 years ago by Tom Hughes

I've managed to find one of emj's attempts in the log - the error is:

ActionView::Template::Error (potlatch2/locales/.swf isn't precompiled):
    31:     flashvars.assets = "<%= asset_path "potlatch2/assets.zip" %>";
    32:     flashvars.font_library = "<%= asset_path "potlatch2/FontLibrary.swf" %>";
    33:     flashvars.locale = "<%= Potlatch2::LOCALES[locale] %>";
    34:     flashvars.locale_paths = "<%= Potlatch2::LOCALES[locale] %>=<%= asset_path("potlatch2/locales/#{Potlatch2::LOCALES[locale]}.swf") %>";
    35:     <% if params['gpx'] %>
    36:     flashvars.gpx = '<%= h(params['gpx']) %>';
    37:     <% end %>
  app/views/site/_potlatch2.html.erb:34:in `_app_views_site__potlatch__html_erb__595222280942956594_53566660'
  app/views/site/edit.html.erb:20:in `_app_views_site_edit_html_erb___2741719446329565646_49458780'
  config/initializers/memory_limits.rb:17:in `call'

which suggests that something went wrong in the locale selection.

comment:4 Changed 6 years ago by Tom Hughes

Specifically it means that this line:

<% locale = request.compatible_language_from(Potlatch2::LOCALES.keys) || "en" %>

must have failed to set locale to anything, despite the "en" fallback.

One thing I do notice is that "sr" is a bit special as we don't have a mapping for it in the Potlatch list, because I wasn't sure which of "sr-EC" and "sr-EL" should be the default. To be honest neither of those codes seems valid anyway - the first would be "Serbian as spoke in Ecuador" and the second is nothing at all because there is no country with "EL" as it's code.

It seems that what Potlatch 2 has as sr-ec is actually the cyrillic variant and sr-el is the latin variant... I will try updating our mappings to match that.

comment:5 Changed 6 years ago by emj

Both of them work if you set your preference to that value, sr_el is the latin version, sr_ec is the crylic version. I have some samples from the SWF files, if someone who speaks serbian wants to chip in:

<String2 value="help.tag"/>
el:    <String2 value="Označavanje"/>
ec:    <String2 value="Означавање"/>

<String2 value="save.editDescription"/>
el:      <String2 value="Unesite opis vaših izmena. Tako će drugi kartografi imati predstavu kakve ste izmene napravili."/>
ec:      <String2 value="Унесите опис ваших измена. Тако ће други картографи имати представу какве сте измене направили."/>


http://cldr.unicode.org/translation/default-content

States that it should be: Serbian (Cyrillic) [sr_Cyrl] or Serbian (Latin) [sr_Latn], with sr defaulting to Crylic.

comment:6 Changed 6 years ago by Tom Hughes

Yes I know what the codes should be, and the web site are ones are correct as "sr" and "sr-Latn". We don't bother with the "-Cyrl" because that is the default script.

Potlatch 2 has it's own weird ideas though, possibly inherited from Flash, which is why we have a mapping table in lib/potlatch2.rb to fix things up. That is what I have just corrected.

I still don't understand why you weren't just getting english though, which is what I was getting.

Anyway, my fix should be live now if people want to test it...

comment:7 in reply to:  6 Changed 6 years ago by metkos@…

Replying to TomH:

I still don't understand why you weren't just getting english though, which is what I was getting.

Anyway, my fix should be live now if people want to test it...

I did a test, your fix is fine. Potlach2 is now starting correctly with "sr,en-US,en" in preffered language settings.

Editor's interface is mix of Serbian and English, but that's probably expected because of incomplete translation.

Thank you.

comment:8 Changed 6 years ago by Tom Hughes

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.