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

CommentFileSizeAuthor
#2 drupal-invalid-URLs.txt294 bytestvi
#1 drupal fix506 bytestvi

Comments

tvi’s picture

StatusFileSize
new506 bytes
tvi’s picture

StatusFileSize
new294 bytes

For 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)

tvi’s picture

Issue tags: +CNR
tvi’s picture

Status: Active » Needs review

Status: Needs review » Needs work
Issue tags: -CNR

The last submitted patch, drupal.diff, failed testing.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.