Skip to content

Commit 65b5337

Browse files
committed
Fixed routing static files in view engine.
1 parent e09a995 commit 65b5337

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const REG_EMPTY = /\s/g;
5656
const REG_SANITIZE_BACKSLASH = /\/\//g;
5757
const REG_WEBSOCKET_ERROR = /ECONNRESET|EHOSTUNREACH|EPIPE|is closed/gi;
5858
const REG_SCRIPTCONTENT = /\<|\>|;/;
59+
const REG_HTTPHTTPS = /^(\/)?(http|https)\:\/\//i;
5960
const REQUEST_PROXY_FLAGS = ['post', 'json'];
6061
const EMPTYARRAY = [];
6162
const EMPTYOBJECT = {};
@@ -8592,8 +8593,12 @@ Framework.prototype._routeStatic = function(name, directory, theme) {
85928593
filename = name;
85938594
else if (name[0] === '/')
85948595
filename = framework_utils.join(theme, this._version(name));
8595-
else
8596+
else {
85968597
filename = framework_utils.join(theme, directory, this._version(name));
8598+
if (REG_HTTPHTTPS.test(filename)) {
8599+
filename = filename.substring(1);
8600+
}
8601+
}
85978602

85988603
return framework.temporary.other[key] = framework_internal.preparePath(this._version(filename));
85998604
};
@@ -11943,7 +11948,7 @@ Controller.prototype.routeScript = function(name, tag) {
1194311948
if (name === undefined)
1194411949
name = 'default.js';
1194511950
var url = self._routeHelper(name, framework.routeScript);
11946-
return tag ? '<script type="text/javascript" src="' + url + '"></script>' : url;
11951+
return tag ? '<script src="' + url + '"></script>' : url;
1194711952
};
1194811953

1194911954
/**
@@ -14818,10 +14823,8 @@ function prepare_filename(name) {
1481814823
}
1481914824

1482014825
function prepare_staticurl(url, isDirectory) {
14821-
1482214826
if (!url)
1482314827
return url;
14824-
1482514828
if (url[0] === '~') {
1482614829
if (isDirectory)
1482714830
return framework_utils.path(url.substring(1));

0 commit comments

Comments
 (0)