MaxMelcher / AzureDevOps.WikiPDFExport

Export Azure DevOps Wiki to PDF
MIT License
187 stars 62 forks source link

Some file attachments do not work #15

Closed dmuscat closed 4 years ago

dmuscat commented 4 years ago

I have tried using several PDF applications, but all of them fail to open some of the file attachments in the generated PDF. It looks like the links created in the PDF that start with file:///.attachments/ do not open, even if the attachment lives in the .attachments folder. Is there any workaround for this? Is it because the PDF reader is expecting the .attachments folder in a different location?

dmuscat commented 4 years ago

I found the solution, it was to URLDecode the filepath to the attachment. The links are then rendered correctly in the PDF.

In CorrectLinksAndImages() method:

                var fileInfo = new FileInfo(**HttpUtility.UrlDecode**(absPath));