dotnet / dotnet/Open-XML-SDK

Malformed URIs are not rewritten

Open
#1,962 1 comment 0 reactions 1 assignee Claimed by @mkaszewiak View on GitHub
Dominant language
C#
Stars
4.6k
Forks
605
PR merge metrics
No merged PRs in 30d

Description

**Steps to reproduce**
- Create a Microsoft Excel workbook (from Excel UI) in which you insert a hyperlink with an invalid URI, such as `file://https:\gna\gna\gna` (Excel allows to insert hyperlinks with invalid URIs).

- Open that workbook with the Open XML SDK.

**Observed behavior**
Malformed URI exception because the URI is invalid and not rewritten.
Indeed, Open XML only rewrites the URI if `Uri.TryCreate("mailto:one@")` returns `false`, but on my computer it returns `true`, so other invalid URIs are not rewritten.

**Expected behavior**
Open XML should not throw any exception, and the invalid URIs should be rewritten into rewritten://{GUID}

**Desktop:**
- OS: Windows
- Office version: version 2508, build 16.0.19127.20192 64 bits
- .NET Target: .NET Framework 4.8
- DocumentFormat.OpenXml Version: 3.3.0

This is really blocking for us and we'd like to keep using Open XML :)

Thanks,
Larry

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.