dentarg / hubot-url-title

:crocodile: Returns the title when a link is posted
https://www.npmjs.com/package/hubot-url-title
4 stars 10 forks source link

Error: Cannot read property 'toLowerCase' of null #9

Open pchaigno opened 8 years ago

pchaigno commented 8 years ago

I get the following error when posting this url: http://www.intel.fr/content/dam/doc/application-note/pci-sig-sr-iov-primer-sr-iov-technology-paper.pdf

Uncaught TypeError: Cannot read property 'toLowerCase' of null
    at Request._callback (node_modules/hubot-url-title/src/scripts/hubot-url-title.coffee:56:57)
    at Request.self.callback (node_modules/request/request.js:123:22)
    at Request.<anonymous> (node_modules/request/request.js:893:14)
    at IncomingMessage.<anonymous> (node_modules/request/request.js:844:12)
    at endReadableNT (_stream_readable.js:906:12)

EDIT: Looks like the error happens for all PDF files :/

dentarg commented 8 years ago

That's unfortunate, a pull request would be appreciated :) (I'm not really using hubot-url-title myself anymore, since HipChat nowadays have this functionality built-in)

pchaigno commented 8 years ago

That's unfortunate, a pull request would be appreciated :)

I'll try to take a go at this in the following days.

I'm not really using hubot-url-title myself anymore, since HipChat nowadays have this functionality built-in

We're using hubot-url-title extensively in one of my IRC channels. I also have other scripts that will require similar tests and functionalities (e.g., a way to handle large files - it currently runs out of memory after a long download). I'd be happy to maintain this package if you don't have time anymore :smiley:

dentarg commented 8 years ago

Sure, I can add you as maintainer here on GitHub, that's very welcome.

I still think getting the title from a website is a fun thing to mess with every now and then. When it comes to IRC, I use https://github.com/dentarg/pynik (pretty old IRC bot in python started by a friend of mine) which I have written a title reader plugin for. I haven't run in to the large file problem yet, but it sounds fun :smile:

I'm going to travel a bit in the next few days, so I might not be able to look at the pull requests right away.

pchaigno commented 8 years ago

Sure, I can add you as maintainer here on GitHub, that's very welcome.

:+1:

I still think getting the title from a website is a fun thing to mess with every now and then.

It sure is :smile:

impca commented 8 years ago

This should fix it: https://github.com/dentarg/hubot-url-title/pull/12

dentarg commented 8 years ago

@impca I'm sorry but just ignoring PDFs doesn't seem like a general fix for this issue :)

dentarg commented 8 years ago

@pchaigno I have added you as maintainer to the github repo :)

pchaigno commented 8 years ago

Closing as PDFs are now ignored by hubot-url-title.

dentarg commented 8 years ago

Are you sure this happened only for PDFs?

On 9 mars 2016, at 17:13, Paul Chaignon notifications@github.com wrote:

Closing as PDFs are now ignored by hubot-url-title.

— Reply to this email directly or view it on GitHub.

pchaigno commented 8 years ago

Hm. You're right. We should probably check the result from this line before calling toLowerCase.