mirror of https://github.com/gorhill/uBlock.git
fix #3636
This commit is contained in:
parent
a3daa804d4
commit
d9161aeffa
|
@ -490,7 +490,7 @@ RedirectEngine.prototype.resourcesFromString = function(text) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var resourcesSelfieVersion = 2;
|
var resourcesSelfieVersion = 3;
|
||||||
|
|
||||||
RedirectEngine.prototype.selfieFromResources = function() {
|
RedirectEngine.prototype.selfieFromResources = function() {
|
||||||
vAPI.cacheStorage.set({
|
vAPI.cacheStorage.set({
|
||||||
|
|
|
@ -20,6 +20,9 @@ with open('./src/web_accessible_resources/to-import.txt', 'r') as f:
|
||||||
if len(line) != 0 and line[0] != '#':
|
if len(line) != 0 and line[0] != '#':
|
||||||
to_import.add(line)
|
to_import.add(line)
|
||||||
|
|
||||||
|
# https://github.com/gorhill/uBlock/issues/3636
|
||||||
|
safe_exts = { 'javascript': 'js' }
|
||||||
|
|
||||||
imported = []
|
imported = []
|
||||||
|
|
||||||
# scan the file until a resource to import is found
|
# scan the file until a resource to import is found
|
||||||
|
@ -40,7 +43,10 @@ def safe_filename_from_token(token, mime):
|
||||||
# extract file extension from mime
|
# extract file extension from mime
|
||||||
match = re.search('^[^/]+/([^\s;]+)', mime)
|
match = re.search('^[^/]+/([^\s;]+)', mime)
|
||||||
if match:
|
if match:
|
||||||
name += '.' + match.group(1)
|
ext = match.group(1)
|
||||||
|
if ext in safe_exts:
|
||||||
|
ext = safe_exts[ext]
|
||||||
|
name += '.' + ext
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def import_resource(f, token, mime):
|
def import_resource(f, token, mime):
|
||||||
|
|
Loading…
Reference in New Issue