diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9c878615a19..cc4b2aac7f0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -287,8 +287,14 @@ function dol_buildpath($path, $type=0) //print $key.'-'.$dirroot.'/'.$path.'-'.$conf->file->dol_url_root[$type].'
'."\n"; if (file_exists($dirroot.'/'.$path)) { - if ($type == 1) $res=DOL_URL_ROOT.$conf->file->dol_url_root[$key].'/'.$path; - if ($type == 2) $res=DOL_MAIN_URL_ROOT.$conf->file->dol_url_root[$key].'/'.$path; + if ($type == 1) + { + $res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':DOL_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path; + } + if ($type == 2) + { + $res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':DOL_MAIN_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path; + } break; } }