Skip to content

Commit

Permalink
send jsdom errors to /dev/null
Browse files Browse the repository at this point in the history
  • Loading branch information
edsu committed May 24, 2017
1 parent ff7f318 commit 33070f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion unshrtn.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ app.set 'json spaces', 2
db = level('./unshrtndb')
jar = request.jar()
process.setMaxListeners(10)
virtualConsole = new jsdom.VirtualConsole()

app.get "/", (req, res) ->
short = req.query.url
Expand Down Expand Up @@ -101,7 +102,7 @@ userAgent = (url) ->


canonical = (url, html) ->
dom = new jsdom.JSDOM(html, url: url)
dom = new jsdom.JSDOM(html, url: url, virtualConsole: virtualConsole)
link = dom.window.document.querySelector('head link[rel=canonical]')
if link and link.attributes and link.attributes.href
url = link.attributes.href.value
Expand Down

0 comments on commit 33070f9

Please sign in to comment.