Skip to content

Malformed URIs are not rewritten #1962

@larrygoldupslide

Description

@larrygoldupslide

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions