From 9be96cb078939e23acbbec1a43128d307f1f9b3d Mon Sep 17 00:00:00 2001 From: Egil Moeller Date: Mon, 5 Apr 2010 18:01:08 +0200 Subject: Bugfixed faststatic to handle plugins properly --- infrastructure/framework-src/modules/faststatic.js | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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'); } }; } -- cgit v1.2.3