From 225a2cec31827f788bed8ef274e55276e6403e2c Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 13 Feb 2022 16:19:58 +0300 Subject: [PATCH] unbork installer, regressed in 81a5acfd --- background/style-via-webrequest.js | 6 ++++-- content/style-injector.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/background/style-via-webrequest.js b/background/style-via-webrequest.js index 4c02b612..9c27740e 100644 --- a/background/style-via-webrequest.js +++ b/background/style-via-webrequest.js @@ -154,8 +154,10 @@ /** @param {chrome.webRequest.WebRequestBodyDetails} req */ function openNamedStyle(req) { - chrome.tabs.update(req.tabId, {url: 'edit.html?id=' + req.url.split('#')[1]}); - return {cancel: true}; + if (!req.url.includes('?')) { // skipping our usercss installer + chrome.tabs.update(req.tabId, {url: 'edit.html?id=' + req.url.split('#')[1]}); + return {cancel: true}; + } } function req2key(req) { diff --git a/content/style-injector.js b/content/style-injector.js index 2ed4874b..ceeb1c60 100644 --- a/content/style-injector.js +++ b/content/style-injector.js @@ -158,7 +158,7 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({ function setTextAndName(el, {id, code = '', name}) { if (exposeStyleName && name) { el.dataset.name = name; - name = encodeURIComponent(name.replace(/[#%/@:']/g, toSafeChar)); + name = encodeURIComponent(name.replace(/[?#%/@:']/g, toSafeChar)); code += `\n/*# sourceURL=${chrome.runtime.getURL(name)}.user.css#${id} */`; } el.textContent = code;