Repository navigation
Preserve percent-encoding in OPC part references - #1070
Merged
Merged
Conversation
Keep escaped OPC part names intact when resolving ZIP entries and serializing signature or relationship URIs. Add generated-package interoperability coverage with System.IO.Packaging. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation consistently preserves encoded paths and includes focused end-to-end verification coverage.
Review tier: Balanced
Findings: None
What changed in this PR
Preserves conforming percent-encoded OPC part names throughout ZIP lookup, signature generation, and relationship serialization.
Changes:
- Uses escaped URI representations for package paths, references, and comparisons.
- Adds coverage for reserved characters, UTF-8 names, nested paths, and signature verification.
- Adds Windows Desktop runtime support for independent verification tests.
| File | Description |
|---|---|
src/Sign.Core/Tools/VsixSignTool/UriHelpers.cs |
Preserves URI escaping during path conversion. |
src/Sign.Core/Tools/VsixSignTool/VSIXSignatureBuilderPreset.cs |
Compares signature paths in escaped form. |
test/Sign.Core.Test/Tools/VSIXSignTool/UriHelpersTests.cs |
Expands URI and relationship serialization coverage. |
test/Sign.Core.Test/Tools/VSIXSignTool/OpcPackageSigningTests.cs |
Tests encoded entries and independent signature verification. |
test/Sign.Core.Test/Sign.Core.Test.csproj |
References WindowsBase through WPF. |
global.json |
Adds the Windows Desktop runtime dependency. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
pjcollins
previously approved these changes
Sep 14, 2026
Preserve encoded OPC entry names while retaining raw and decoded URI delimiter validation before part creation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff04667a-44b8-4113-b777-a18549f5819e
pjcollins
approved these changes
Sep 14, 2026
This was referenced Sep 28, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1071.
Summary
Preserve existing percent-encoding when resolving and serializing OPC part URIs.
This fixes conforming packages whose physical ZIP entry names are already encoded—for example,
ab%23c.txt. Signature references now retain%23exactly once instead of emitting either#or%2523.The change:
Reference/@URIvalues and relationship targets;#,?,%, UTF-8 names, nested paths, and ordinary names;PackageDigitalSignatureManager.VerifySignatures().Scope
This PR handles conforming OPC part names that are already percent-encoded in the physical ZIP package.
It does not make raw URI delimiters in ZIP entry names valid. #1069 separately rejects raw
#and?characters before URI parsing and carries the fix for #998.This supersedes the escaping approach in #1063, which can double-encode an already-conforming name such as
ab%23c.txtasab%2523c.txt.Testing
All discovered solution tests pass: 780 passed, 1 skipped, 0 failed.
This change adds 3 test methods and expands existing URI-helper theories to cover:
#,?, and%characters;Reference/@URIvalues;PackageDigitalSignatureManager.VerifySignatures().All test packages are constructed dynamically; no binary
.vsixfixtures are added.