Escape parameters in javascript: sauce links.

This commit is contained in:
ccd0 2014-10-13 00:20:59 -07:00
parent 3317f6250f
commit fd5097af3d

View File

@ -29,14 +29,14 @@ Sauce =
'%TURL': post.file.thumbURL
'%URL': post.file.URL
'%MD5': post.file.MD5
'%board': post.board
'%board': post.board.ID
'%name': post.file.name
'%%': '%'
'%semi': ';'
}[parameter]
if key is 'url' and parameter isnt '%%' and parameter isnt '%semi'
encodeURIComponent type
else
type = JSON.stringify type if /^javascript:/i.test parts['url']
type = encodeURIComponent type
type
ext = post.file.URL.match(/\.([^\.]*)$/)?[1] or ''
return null unless !parts['boards'] or post.board.ID in parts['boards'].split ','
@ -44,6 +44,7 @@ Sauce =
a = Sauce.link.cloneNode true
a.href = parts['url']
a.textContent = parts['text']
a.removeAttribute 'target' if /^javascript:/i.test parts['url']
a
node: ->
return if @isClone or !@file