From 53fddeb1c3b8426c12021928332dff686c49d1e1 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 16 Sep 2020 07:13:45 +0200 Subject: [PATCH] revert #folder handling --- lib/util/identifier.js | 4 +--- test/identifier.js | 12 ++++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/util/identifier.js b/lib/util/identifier.js index b69a3c80..25979815 100644 --- a/lib/util/identifier.js +++ b/lib/util/identifier.js @@ -12,9 +12,7 @@ const EMPTY = ""; * @returns {[string, string, string]|null} parsed identifier */ function parseIdentifier(identifier) { - const match = /^(#?(?:[/\\]#[^/\\?]|[^?#])*)(\?[^#]*)?(#.*)?$/.exec( - identifier - ); + const match = /^(#?[^?#]*)(\?[^#]*)?(#.*)?$/.exec(identifier); if (!match) return null; diff --git a/test/identifier.js b/test/identifier.js index 1bab1ca0..214d7bb1 100644 --- a/test/identifier.js +++ b/test/identifier.js @@ -37,19 +37,19 @@ describe("parse identifier. edge cases", () => { }, { input: "path/#repo#hash", - expect: ["path/#repo", "", "#hash"] + expect: ["path/", "", "#repo#hash"] }, { input: "path/#r#hash", - expect: ["path/#r", "", "#hash"] + expect: ["path/", "", "#r#hash"] }, { input: "path/#repo/#repo2#hash", - expect: ["path/#repo/#repo2", "", "#hash"] + expect: ["path/", "", "#repo/#repo2#hash"] }, { input: "path/#r/#r#hash", - expect: ["path/#r/#r", "", "#hash"] + expect: ["path/", "", "#r/#r#hash"] }, { input: "path/#/not/a/hash?not-a-query", @@ -77,11 +77,11 @@ describe("parse identifier. Windows-like paths", () => { }, { input: "path\\#repo#hash", - expect: ["path\\#repo", "", "#hash"] + expect: ["path\\", "", "#repo#hash"] }, { input: "path\\#r#hash", - expect: ["path\\#r", "", "#hash"] + expect: ["path\\", "", "#r#hash"] }, { input: "path\\#/not/a/hash?not-a-query",