Hi,

for generating the URL to the county icon the url() function is currently used in countryicons_get_icon_url(). Unfortunately, url() breaks for files if you have a multilingual website and language prefixes in the URL, e.g. http://example.com/en. Any URL generated by url() will be passed to hook_url_outbound_alter() and the locale module then adds the language prefix. However, that's not the behaviour we want for files, the url for county icons will be wrong in that case. Instead we have to use file_create_url() that is save against url rewriting.

Attached patch fixes this issue.

CommentFileSizeAuthor
countryicons_file_create_url.patch489 bytesmh86
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Scyther’s picture

Thanks for that bug!

Scyther’s picture

Status: Needs review » Needs work

Your patch says

  return file_create_url($icon_path, array('absolute' => TRUE));

file_create_url() only takes one paramater $uri, so this might need some work.

https://api.drupal.org/api/drupal/includes!file.inc/function/file_create...