I have a website running in the sub directory for example http://example.com/info.
In the settings.php I have $base_url = 'http://example.com/info';
and in .htaccess I have RewriteBase /info
.
When I create a link field and input internal URL (eg. user/login), I get a result with base URL duplicate (eg. http://example.com/info/info/user/login).
This is happening because in the _link_sanitize() function on line 517 we have the following code:
if (!empty($url_parts['url'])) {
$item['url'] = url($url_parts['url'],
array('query' => isset($url_parts['query']) ? $url_parts['query'] : NULL,
'fragment' => isset($url_parts['fragment']) ? $url_parts['fragment'] : NULL,
'absolute' => !empty($instance['settings']['absolute_url']),
'html' => TRUE,
)
);
}
The link URL gets sanitized and converted into /info/user/login because of the url() function and then, when its processed by the theme_link() at the end, the Drupal will add /info again.
Comment | File | Size | Author |
---|---|---|---|
#13 | link-n2898414-13.patch | 667 bytes | DamienMcKenna |
|
Issue fork link-2898414
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
Vlad Stratulat CreditAttribution: Vlad Stratulat commentedComment #3
Vlad Stratulat CreditAttribution: Vlad Stratulat commentedComment #4
Vlad Stratulat CreditAttribution: Vlad Stratulat commentedComment #5
Vlad Stratulat CreditAttribution: Vlad Stratulat commentedI've created a patch for this. Can someone review and merge it?
Comment #6
Vlad Stratulat CreditAttribution: Vlad Stratulat commentedIt seems like its failing the test but the output is correct.
Comment #7
Vlad Stratulat CreditAttribution: Vlad Stratulat commentedPatching the URL only if the base path is longer then 1 symbol (not just /).
Comment #8
Vlad Stratulat CreditAttribution: Vlad Stratulat commentedPatching the URL only if the base path is longer then 1 symbol (not just /).
Comment #10
DiDebruWe encountered this bug in 7.x-1.11 would be great if the patch could be committed.
Patch looks good.
Comment #11
DamienMcKennaThis is the file from #7 with a filename that the test infrastructure can use.
Comment #12
DiDebruPatch failed to apply.
Comment #13
DamienMcKennaDoh.
Comment #14
DamienMcKennaLet's add test coverage to make sure this doesn't break in the future.