html2docx icon indicating copy to clipboard operation
html2docx copied to clipboard

Tweak to handle links without href

Open djplaner opened this issue 3 years ago • 2 comments

Thanks for creating and sharing html2docx, much appreciated.

FYI, I had an issue converting some user generated HTML that included a link without a href, throwing an error

File: "...h2d.py", line 514, in handle_data
    self.handle_link(link['href'], data)
KeyError: 'href'

My kludged solution

if link:
    if 'href' in link:
        self.handle_link(link['href'],data)

Not sure if there are broader implications of this, but it serves my immediate purpose.

djplaner avatar Sep 25 '21 22:09 djplaner

Hey @djplaner, thanks for pointing this out. Will look into fixing this for the next release.

pqzx avatar Oct 24 '21 05:10 pqzx

had this issue today - is there a chance to fix it?

lury avatar Nov 17 '22 07:11 lury