diff options
author | Egil Moeller <egil.moller@freecode.no> | 2010-04-05 18:01:08 +0200 |
---|---|---|
committer | Egil Moeller <egil.moller@freecode.no> | 2010-04-05 18:01:08 +0200 |
commit | 9be96cb078939e23acbbec1a43128d307f1f9b3d (patch) | |
tree | 8dd7129e1d6e85ba6ef2ba01e8feed9164aa33f3 | |
parent | 2360189e31dc0b5de04edbea623e699823b04b3e (diff) | |
download | etherpad-9be96cb078939e23acbbec1a43128d307f1f9b3d.tar.gz etherpad-9be96cb078939e23acbbec1a43128d307f1f9b3d.tar.xz etherpad-9be96cb078939e23acbbec1a43128d307f1f9b3d.zip |
Bugfixed faststatic to handle plugins properly
-rw-r--r-- | infrastructure/framework-src/modules/faststatic.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/infrastructure/framework-src/modules/faststatic.js b/infrastructure/framework-src/modules/faststatic.js index 5cca676..920be8c 100644 --- a/infrastructure/framework-src/modules/faststatic.js +++ b/infrastructure/framework-src/modules/faststatic.js @@ -104,11 +104,35 @@ function _getMTime(f) { } } +function manglePluginPath(localFile, fileType) { + var prefix = '/static/' + fileType + '/plugins/'; + if (localFile.substring(0, prefix.length) != prefix) + return localFile; + var suffix = localFile.substring(prefix.length); + var plugin = suffix.split('/', 1)[0]; + suffix = suffix.substring(plugin.length + 1); + return '/plugins/' + plugin + '/static/' + fileType + '/' + suffix; +} + +function manglePluginPaths(localFile) { + return manglePluginPath( + manglePluginPath( + manglePluginPath( + manglePluginPath( + manglePluginPath( + localFile, + 'js'), + 'css'), + 'swf'), + 'html'), + 'zip'); +} + function _wrapFile(localFile) { return { getPath: function() { return localFile; }, getMTime: function() { return _getMTime(localFile); }, - getContents: function() { return _readFileAndProcess(localFile, 'string'); } + getContents: function() { return _readFileAndProcess(manglePluginPaths(localFile), 'string'); } }; } |