incremental-reading icon indicating copy to clipboard operation
incremental-reading copied to clipboard

Import fails if no title set on Web page

Open choralbari opened this issue 6 months ago • 1 comments

Describe the bug When attempting to import from a Web page that has no title, the process fails and Anki becomes unusable, requiring a restart.

To Reproduce Steps to reproduce the behavior:

  1. Select Read->Import Webpage
  2. Enter the URL of a page that has no title, for example "https://docs.aws.amazon.com/eks/"
  3. Click OK.
  4. See error.

Expected behavior The page is imported successfully. I could imagine using a default title, building a sane title from the page content, or prompting the user for a title.

Debug info

Anki 24.06.2 (33a92379) (ao) Python 3.9.18 Qt 6.6.2 PyQt 6.6.1 Platform: macOS-14.5-arm64-arm-64bit

Traceback (most recent call last): File "/Users/REDACTED/Library/Application Support/Anki2/addons21/999215520/importer.py", line 146, in importWebpage title = webpage.title.string or url AttributeError: 'NoneType' object has no attribute 'string'

===Add-ons (active)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) Incremental Reading v4119 unofficial clone ['999215520', 2023-11-22T18:54, 'None', '']

===IDs of active AnkiWeb add-ons=== 999215520

===Add-ons (inactive)=== (add-on provided name [Add-on folder, installed at, version, is config changed])

choralbari avatar Jul 30 '24 13:07 choralbari