mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Ignore requests to other hosts.
This commit is contained in:
@@ -8,7 +8,7 @@ hostPathMap = {}
|
||||
hostPathMapNextKey = 0
|
||||
|
||||
getHostForPath = (path) ->
|
||||
key = "extension-#{hostPathMapNextKey}"
|
||||
key = "extension-#{++hostPathMapNextKey}"
|
||||
hostPathMap[key] = path
|
||||
key
|
||||
|
||||
@@ -23,6 +23,8 @@ app.once 'ready', ->
|
||||
parsed = url.parse request.url
|
||||
return unless parsed.hostname and parsed.path?
|
||||
|
||||
return unless /extension-\d+/.test parsed.hostname
|
||||
|
||||
directory = getPathForHost parsed.hostname
|
||||
return new protocol.RequestFileJob(path.join(directory, parsed.path))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user