For a specific setup i'm using custom_url_rewrite_outbound to alter links to add a query string (f.e every link now has ?somevar=x).
Admin menu uses url() to get the base path, but this generates an incorrect link.
// The base path to use for cache requests depends on whether clean URLs
// are enabled, whether Drupal runs in a sub-directory, and on the language
// system configuration. url() already provides us the proper path, but we
// additionally need to ensure that it ends with a slash.
$settings['basePath'] = rtrim(url(''), '/') . '/';
In my case this generates a cache link to f.e.
http://mydomain/?somevar=x/js/admin_menu/cache/cd1537ffda2f98ac7b4110bb4...
because my alterations are present in an url() call.
It works when I change it to
$settings['basePath'] = rtrim(base_path(), '/') . '/';
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | admin_menu-DRUPAL-6--3.basepath.patch | 2.1 KB | sun |
Comments
Comment #1
sunThat's unfortunate, because your proposed fix won't work for the other cases mentioned in the comment right above that line (which you kindly pasted here as well).
Is that query string required on your site? Would it work if we would strip any additional, custom query string?
Comment #2
interx commentedI understand how it wouldn't work in all circumstances.
Unfortunately the custom query string is needed for this project, so I can't remove it now.
As you suggested, the url() call with an extra check to remove everything starting from '?', if function custom_url_rewrite_outbound exists, would solve the issue in general. (And I'd say the same for '#' as someone could alter all links to add a fragment too).
Comment #3
sunPlease test attached patch.
Comment #4
sunAlso created a core issue for this: #481560: Provide proper AJAX URL resp. base path depending on context
Comment #5
interx commentedPatch tested and works with and without custom_url_rewrite_outbound changes, both tested with clean url's disabled and enabled.
Thanks!
Comment #6
sunThanks for reporting, reviewing, and testing! Committed to all branches.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.