Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed bug with generation of asset URL when running server on MS Windows #562

Merged
merged 1 commit into from

2 participants

@Mart-Bogdan

Fixed bug with generation of asset URL when running server on MS Windows it used windows specific path separator \ which is incorrect for HTTP protocol, now is using / on any OS.

@Mart-Bogdan Mart-Bogdan Fixed bug with generation of asset URL when running server on MS Wind…
…ows.

it used windows specific path separator \ which is incorrect for HTTP protocol, now is using / on any OS.
ebdfc63
@mde mde merged commit cc3582a into from
@mde
Owner
mde commented

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 6, 2014
  1. @Mart-Bogdan

    Fixed bug with generation of asset URL when running server on MS Wind…

    Mart-Bogdan authored
    …ows.
    
    it used windows specific path separator \ which is incorrect for HTTP protocol, now is using / on any OS.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/template/helpers/index.js
View
10 lib/template/helpers/index.js
@@ -27,7 +27,8 @@ _getAssetPath = function (assetType, src) {
var host
, basePath
, hasProto = /^http:\/\/|^https:\/\/|^data:/
- , isAbs;
+ , isAbs
+ , assetPath;
// Does not handle exotic protocols like SPDY, or file:// URLs
isAbs = hasProto.test(src) || utils.file.isAbsolute(src);
@@ -40,7 +41,12 @@ _getAssetPath = function (assetType, src) {
// Include poss. extra leading slash in path.join to ensure
// there's at least one
- return host + path.join('/', basePath, assetType, src);
+ assetPath = host + path.join('/', basePath, assetType, src);
+
+ // If we are running server on MS Windows it generates asset paths \ instead of /
+ // some browsers (for example FF 27.0.1) is sending this symbols as %5C in GET request
+ // which results in 404 from server, but / is usable on any OS.
+ return process.platform === 'win32' ? assetPath.replace(/\\/g, '/') : assetPath;
};
Something went wrong with that request. Please try again.