Problem/Motivation

It seems that calls like /fr/js/teaser_region_front?js_theme=my_theme&js_module=my_module&js_callback=teaser_region_front&js_token=&items=2&arguments= loose the language prefix.
The url is created using $(this).jsCallback('my_module', 'teaser_region_front',{}) so I guess it fits the API.
Unfortunately js_update_path() doesn't seem to take the language prefix in account. The language prefix is properly detected in js_execute_request() and stored in the global $_js['lang'].
However rebuilding the path in js_update_path() ignores the path prefix.
js_update_path() was introduced by #2724737: Always update path when bootstrap level is DRUPAL_BOOTSTRAP_LANGUAGE and above which basically was also about fixing the path prefix I just can speculate that this was about paths like js/fr/my_callback?js_.... because js_update_path() works perfectly for such a scenario.

Proposed resolution

I suggest to modify js_update_path() to check if $_js['lang'] exists and if so add it as prefix.
If that's not viable I assume the code in js.js has to be adjusted to put the endpoint before the path prefix.
Attached patch uses the former approach.

Remaining tasks

Reviews needed.

User interface changes

None.

API changes

None. Same to use as before just supports fr/js/callbaccky and js/fr/callback.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

das-peter created an issue. See original summary.

  • markcarver committed 463e738 on 7.x-2.x authored by das-peter
    Issue #2850287 by das-peter: Followup #2724737: Keep path prefix in...
markhalliwell’s picture

Status: Needs review » Fixed
plach’s picture

Status: Fixed » Needs review
FileSize
603 bytes

This caused a regression with some jsGet calls in our custom code: the server was returning the following error: The requested URL "/en/en/..." could not be found. . The attached patch fixed the issue.

  • markcarver committed 59fd878 on 7.x-2.x authored by plach
    Issue #2850287 by das-peter, plach: Followup #2724737: Keep path prefix...
markhalliwell’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.