Drupal outputs invalid URLs for JS and CSS (actually full local pathes) when using cache with non default system & temp directories.
The attached patch fixes that.
How to reproduce :
- go to /admin/settings/file-system
- set "File system path" to eg "/var/www/sites/default/files"
- set "Temporary directory" to "/var/tmp"
- save settings.
- open main main Drupal page (here http://localhost/drupal/)
It's full of invalid URIs, that is full pathes concatenated to relative URLs such as:
note the invalid /drupal//var/www/sites/default/files path that should have been /drupal/sites/default/files
(resp //var/www/sites/default/files instead of //sites/default/files for a site directly at /)
This is because:
- in such configurations, modules/locale/locale.module::locale_update_js_files store full pathes
- modules/locale/locale.module::locale_update_js_files then:
o just use these full pathes,
o pass them to includes/file.inc::file_create_path() which prepend drupal
URI (here /drupal/) before (since the full path is not part of drupal install path)
o calls includes/common.inc::drupal_add_js() which then output these invalids
URLs in the web page
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupal-invalid-URLs.txt | 294 bytes | tvi |
| #1 | drupal fix | 506 bytes | tvi |
Comments
Comment #1
tvi commentedComment #2
tvi commentedFor the record, this has been tested with both Apache+mod_php and nginx+php-fpm, on both RHEL5.5 & FC14, with php-5.3.3
I attach the extracted bits of outputed HTML since it got removed when saving the initial description (because it was interpreted as HTML, and HTML tags are resctriced in comments)
Comment #3
tvi commentedComment #4
tvi commented