When we were trying to investigate an issue for one of our clients we found out that links in SharePoint Online’s web view are broken in Aspose.Words 22.2 and other versions.
We specifically don’t know which version of Aspose.Words DLL introduced this issue, but when we tested the following versions listed below, all of them were resulting in the same bug. Where there is an addition of \h\l or \l to the link.
Aspose.Words versions tested:
- Aspose.Words 22.3
- Aspose.Words 22.2
- Aspose.Words 22.1
- Aspose.Words 21.10
- Aspose.Words 21.5
- Aspose.Words 21.1
- Aspose.Words 20.5
We also tested the latest version of Aspose.Words 22.4 and found out that the issue was not reproduced, however, the Aspose release notes for this version of Aspose.Words don’t mention anything about this fix.
We want to understand what the issue was and how it got solved. We also want to make sure that this was not fixed unknowingly and it did not introduce other issues in Aspose.Words 22.4 and the issue will not come back in future releases.
We have tried to create a simple console application to reproduce the issue with Aspose.Words 22.2.
- It contains “Doc1.docx“ document in “Word File“ folder which contains a link to “https://linktek.sharepoint.com/sites/Raghu/Shared Documents/Vahe - Test/Modify Links Test/Glossary.pdf”.
- Since it would be difficult to create a console application which would interact with SPO (we would need to implement whole CSOM API there) and considering the fact that the issue can be partially reproduced with running Aspose.Words DLL methods on local files and then uploading them to SPO, we decided to run the application on the local file from the previous step.
- The program loads the file, gets the hyperlink, changes it to “https://linktek.sharepoint.com/sites/Raghu/Shared Documents/Vahe - Test/Moved Test/Glossary.pdf” and saves the file back to “\AsposeWordCorruption\bin\Debug\Word File\Doc1 AFTER.docx“ output file.
Interestingly, our console application is able to reproduce the issue only with licensed version of Aspose.Words. With trial version the link looks and works okay after uploading file to SharePoint Online. Screenshots have been attached below.
The console application can be accessed from this link: https://files.axiomint.com/external/folder/6xnob45d68379c5d8424e95bed05974ea80e3