Cannot launch instances in French (using the modal)

Bug #1311047 reported by Adrien Cunin
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Adrien Cunin
Icehouse
Fix Released
High
Adrien Cunin

Bug Description

I noticed this in Icehouse with Horizon translated in French: the "Launch instance" form is broken due to a syntax error in the quota handling javascript when strings contain a single quote.

Patch on the way.

Tags: i18n
Adrien Cunin (adri2000)
Changed in horizon:
assignee: nobody → Adrien Cunin (adri2000)
status: New → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/89534

Julie Pichon (jpichon)
tags: added: i18n icehouse-backport-potential
Changed in horizon:
importance: Undecided → Medium
Revision history for this message
Cristian Fiorentino (cristian-fiorentino) wrote : Re: Non-escaped string in JS breaks "launch instance" form translated in French

Having reviewed the path it is not clear to me how the single quotes are obtained in:

  some_disabled_msg = '{{_("Some flavors not meeting minimum image requirements have been disabled.")|escapejs}}';
  all_disabled_msg = '{{_("No flavors meet minimum criteria for selected image.")|escapejs}}';

it seems it is being used |escapejs against a harcoded text which is not to be translated, and with no single quotes; but not sure if I am missing anything. Thanks.

Revision history for this message
Adrien Cunin (adri2000) wrote :

Cristian,

_("hardcoded text") returns the translated hardcoded text, which in French would be "foo'bar". Filtering the final string with escapejs should prevent the issue with any language, even English if a quote is introduced at some point.

Revision history for this message
Cristian Fiorentino (cristian-fiorentino) wrote :

Got it. Thanks.

Revision history for this message
Doug Fish (drfish) wrote :

Not sure its worthwhile to argue the importance of this (since its getting active attention), but this seems like a pretty severe bug to me: a French user cannot launch instances at all.

Revision history for this message
Adrien Cunin (adri2000) wrote :

Agreed, although to be completely fair there is an easy workaround: open in a new tab, so that you bypass the broken javascript.

Julie Pichon (jpichon)
Changed in horizon:
importance: Medium → High
summary: - Non-escaped string in JS breaks "launch instance" form translated in
- French
+ Cannot launch instances in French (using the modal)
Revision history for this message
Doug Fish (drfish) wrote :

Adrien - yes thanks for the workaround! That helps, but I'd still really hope to see this in our first fix release.

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/89534
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=bc6f40b51d53682054cc4ba28b55b5045d6c8605
Submitter: Jenkins
Branch: master

commit bc6f40b51d53682054cc4ba28b55b5045d6c8605
Author: Adrien Cunin <email address hidden>
Date: Tue Apr 22 12:54:33 2014 +0200

    Use escapejs filter on JavaScript strings

    The escapejs filter will correctly escape single quotes from JavaScript
    strings which may otherwise trigger syntax errors. In this case, the
    issue was visible using the French translation.

    Also removed a trailing paranthesis coming out of nowhere.

    Change-Id: I25001815e17be5afa8eb28cc28c5423e3dcd973c
    Closes-Bug: #1311047

Changed in horizon:
status: In Progress → Fix Committed
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to horizon (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/92006

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/icehouse)

Reviewed: https://review.openstack.org/92006
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=232b71286f3b1426412a3ffbed5d7065c2e24275
Submitter: Jenkins
Branch: stable/icehouse

commit 232b71286f3b1426412a3ffbed5d7065c2e24275
Author: Adrien Cunin <email address hidden>
Date: Tue Apr 22 12:54:33 2014 +0200

    Use escapejs filter on JavaScript strings

    The escapejs filter will correctly escape single quotes from JavaScript
    strings which may otherwise trigger syntax errors. In this case, the
    issue was visible using the French translation.

    Also removed a trailing paranthesis coming out of nowhere.

    Change-Id: I25001815e17be5afa8eb28cc28c5423e3dcd973c
    Closes-Bug: #1311047
    (cherry picked from commit bc6f40b51d53682054cc4ba28b55b5045d6c8605)

Thierry Carrez (ttx)
Changed in horizon:
milestone: none → juno-1
status: Fix Committed → Fix Released
Yaguang Tang (heut2008)
tags: removed: icehouse-backport-potential
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.