function path returns not the whole pathname

the path function will not return the whole pathname if audio.js is a part of the path itself
for e.g.
if the script is loaded from http://example.com/js/audio.js/audio.js
it will returns only http://example.com/js/
instead of http://example.com/js/audio.js/

before the change - from line 10 :

<code>
      if(re.test(path) return path.replace(re, '');
</code>

after the change - from line 10 till 15
<code>
     if(re.test(path))
      {
        var f = path.split ( '/' );
	f.pop ();
	return f.join ( '/' ) + '/';
      }
</code>