diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index cd2973e54c9..a3289207914 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -116,7 +116,7 @@ function dol_buildpath($path,$mode=0)
// FIXME Trying to know if a file on disk exist by forging path on disk from url
// works only for some web server and some setup. This is bugged when
// using proxy, rewriting, virtual path, etc...
- preg_match('/^([^.]+(\.css)?\.php)/i',$path,$regs);
+ preg_match('/^([^.]+(\.css)?(\.php)?(\.js)?)/i',$path,$regs);
if (! empty($regs[1])) $filepath = $regs[1];
// An alternative for proxy but extremely slow
//$url = 'http://'.$_SERVER["SERVER_NAME"].DOL_URL_ROOT.$path;
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 6e510b27348..c2f098157fb 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -855,7 +855,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
{
foreach($arrayofcss as $cssfile)
{
- print ''."\n";
+ print ''."\n";
}
}
@@ -894,7 +894,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
foreach($arrayofjs as $jsfile)
{
if (! preg_match('/^\//',$jsfile)) $jsfile='/'.$jsfile; // For backward compatibility
- print ''."\n";
+ print ''."\n";
}
}