Closed (won't fix)
Project:
Internationalization
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Sep 2006 at 20:31 UTC
Updated:
1 Dec 2009 at 16:04 UTC
i18n.inc brokes access to uploaded files, because the access is public and the module prepend the locale string before "files". So, i created this path
i18n.inc
Index: i18n.inc
===================================================================
--- i18n.inc (revisión: 19)
+++ i18n.inc (copia de trabajo)
@@ -25,8 +25,15 @@
}
function i18n_url_rewrite($type, $path, $original){
+ if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) {
+ $fdp=variable_get("file_directory_path","files").'/';
+ $is_file=(strpos($path,$fdp)===0);
+ } else {
+ $is_file=false;
+ }
+ //drupal_set_message("$path ".((strpos($path,$fdp)===0)?"si":"no"));
//drupal_set_message("type=$type path=$path original=$original");
- if ($type == 'alias' && !i18n_get_lang_prefix($path) ){
+ if ($type == 'alias' && !i18n_get_lang_prefix($path) && !$is_file){
return $path ? i18n_get_lang() . '/'. $path : i18n_get_lang();
} else {
return $path;
Comments
Comment #1
jose reyero commentedThis doesn't seem to happen with core modules.
File paths are not even supossed to be rewritten this way for public uploads.
So, does this happen with upload module only?. Can you provide some more details?
Comment #2
hexa commentedThis also happens when using Audio module.
Now my audio download don't work anymore cause links look like this:
/sl/audio/download/17/MUSICALLSD+-+2+SIDES+OF+THE+SAME+COIN.mp3
instead like:
/audio/download/17/MUSICALLSD+-+2+SIDES+OF+THE+SAME+COIN.mp3
Comment #3
Dave Cohen commentedI've just discoved this problem on my site as well. I think it does affect core modules, because a number of user pictures have been uploaded into en/files/pictures instead of files/pictures. Also into en/files/color (also core). And non-core files saved by bueditor, imce and upapi modules are also in en/.
And in my case this has the nasty side effect of breaking the homepage links. For example www.greatsunflower.org is OK, but www.greatsunflower.org/en is not. The reason being that /en is now a directory that is actually found, so the normal url rewriting in .htaccess is not done.
Comment #4
Dave Cohen commentedWait. I just discovered the problem is not what I thought...
It seems at some point I created the en directory and put in it a symbolic link to my files. So it looks like this is my own fault.
Comment #5
jose reyero commentedSo it seems for some people it is fixed.
For the rest: i18n rewriting does work for file paths, as the core upload module proves.
For other modules, create an issue for them for not using url() for files, which is conceptually wrong.