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(), '/') . '/';
CommentFileSizeAuthor
#3 admin_menu-DRUPAL-6--3.basepath.patch2.1 KBsun

Comments

sun’s picture

That'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?

interx’s picture

I 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).

sun’s picture

Status: Active » Needs review
StatusFileSize
new2.1 KB

Please test attached patch.

sun’s picture

interx’s picture

Patch tested and works with and without custom_url_rewrite_outbound changes, both tested with clean url's disabled and enabled.

Thanks!

sun’s picture

Status: Needs review » Fixed

Thanks 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.

Status: Fixed » Closed (fixed)

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