alphapapa / pocket-reader.el

Emacs client for Pocket reading list (getpocket.com)
GNU General Public License v3.0
223 stars 12 forks source link

Handle rare items with empty or invalid URL #19

Closed wedens closed 4 years ago

wedens commented 4 years ago

When I start pocket-reader, I get replace-regexp-in-string: Wrong type argument: arrayp, nil error.

I tried to re-authorize, but after re-authorizing the issue persists.

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  substring(nil 0 0)
  replace-regexp-in-string("\\`\\(?:amp\\|www\\)\\." "" nil)
  pocket-reader--url-domain("")
  pocket-reader--get-url(#<hash-table eq 21/65 0x157848926b89>)
  pocket-reader--add-items((... ... ... ... ... ... ... ... ... ... ... ... ... ... ...))
  pocket-reader-search(nil)
  pocket-reader-refresh()
  pocket-reader-mode()
  pocket-reader()
  funcall-interactively(pocket-reader)
  call-interactively(pocket-reader nil nil)
  command-execute(pocket-reader)

Emacs version: master (5a3e96b17c2a948ac952295962dc6e281ec5cad5). Latest pocket-reader version.

alphapapa commented 4 years ago

That would seem to indicate that one of your Pocket items has an empty URL string, which is strange. I suppose we should account for that possibility, but it ought to be extremely rare, and might indicate a mistake on Pocket's end at some time in the past (e.g. when the item was added).

wedens commented 4 years ago

Yes, you're right. I've found an item in pocket web ui that doesn't display any url (but it still opens the page if try to). Removing this item makes pocket-reader usable again.

I'll let you decide whether to close the issue now or when/if you'd like to add a workaround.

Thanks!

wedens commented 4 years ago

Btw, the problem is reproducible with this page https://www.javiercasas.com/articles/codata-in-action.

alphapapa commented 4 years ago

Thanks, I'll look into adding checks for this.

Btw, the problem is reproducible with this page https://www.javiercasas.com/articles/codata-in-action.

Sorry, I don't understand what you mean.

wedens commented 4 years ago

Sorry, I don't understand what you mean.

If you add this page to the pocket, you'll get this problem in pocket-reader.el.

alphapapa commented 4 years ago

Add it to Pocket how? With what software?

wedens commented 4 years ago

Official web page https://app.getpocket.com/ will add it without an url or whatever makes it broken.

alphapapa commented 4 years ago

Have you reported that bug to Pocket?

wedens commented 4 years ago

No. Even though it seems to be wrong, it works fine in their official web and android client. So, unless it's some API specification violation, they may not consider it an issue on their side :/

alphapapa commented 4 years ago

Isn't app.getpocket.com an official Web client? If it saves an entry with an empty URL, that's definitely a bug in their code.