[Pkg-javascript-commits] [less.js] 08/38: revert original fix for #2360 and fix #2360 by constructing the URL using a Quoted type instead of an anonymous one, since the url is quoted.

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:27:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.2.0
in repository less.js.

commit 99da1f21a372cc1b6cc62c387b75c89409e4721b
Author: Luke Page <luke.a.page at gmail.com>
Date:   Thu Jan 1 16:41:02 2015 +0000

    revert original fix for #2360 and fix #2360 by constructing the URL using a Quoted type instead of an anonymous one, since the url is quoted.
---
 lib/less/contexts.js      | 7 -------
 lib/less/functions/svg.js | 6 +++---
 lib/less/tree/url.js      | 1 -
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/lib/less/contexts.js b/lib/less/contexts.js
index e21706e..5c0ef6d 100644
--- a/lib/less/contexts.js
+++ b/lib/less/contexts.js
@@ -79,13 +79,6 @@ contexts.Eval.prototype.isPathRelative = function (path) {
     return !/^(?:[a-z-]+:|\/)/i.test(path);
 };
 
-contexts.Eval.prototype.isPathExternal = function (path) {
-  // An URL is external if
-  // 1. it's a Data Url
-  // 2. it's an absolute url or and protocol-relative
-  return /^data:|^(https?:)?\/\/|^[\{\}\[\]#*;,'§\$%&\(=?`´\^°<>]/.test(path);
-};
-
 contexts.Eval.prototype.normalizePath = function( path ) {
     var
       segments = path.split("/").reverse(),
diff --git a/lib/less/functions/svg.js b/lib/less/functions/svg.js
index ba80302..f816041 100644
--- a/lib/less/functions/svg.js
+++ b/lib/less/functions/svg.js
@@ -1,7 +1,7 @@
 module.exports = function(environment) {
     var Dimension = require("../tree/dimension"),
         Color = require("../tree/color"),
-        Anonymous = require("../tree/anonymous"),
+        Quoted = require("../tree/quoted"),
         URL = require("../tree/url"),
         functionRegistry = require("./function-registry");
 
@@ -77,7 +77,7 @@ module.exports = function(environment) {
             }
         }
 
-        returner = "'data:image/svg+xml" + (useBase64 ? ";base64" : "") + "," + returner + "'";
-        return new URL(new Anonymous(returner), this.index, this.currentFileInfo);
+        returner = "data:image/svg+xml" + (useBase64 ? ";base64" : "") + "," + returner;
+        return new URL(new Quoted("'" + returner + "'", returner, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo);
     });
 };
diff --git a/lib/less/tree/url.js b/lib/less/tree/url.js
index 71f39ac..c61cffb 100644
--- a/lib/less/tree/url.js
+++ b/lib/less/tree/url.js
@@ -25,7 +25,6 @@ URL.prototype.eval = function (context) {
         rootpath = this.currentFileInfo && this.currentFileInfo.rootpath;
         if (rootpath &&
             typeof val.value === "string" &&
-            !context.isPathExternal(val.value) &&
             context.isPathRelative(val.value)) {
 
             if (!val.quote) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list