Emit valid SARIF URIs for AL code analysis paths containing spaces#2330
Open
aholstrup1 wants to merge 2 commits into
Open
Emit valid SARIF URIs for AL code analysis paths containing spaces#2330aholstrup1 wants to merge 2 commits into
aholstrup1 wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes invalid SARIF artifact URIs for AL file paths containing spaces.
Changes:
- Adds segment-wise URI encoding while preserving
/. - Integrates encoding into SARIF generation.
- Adds tests and release documentation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
ProcessALCodeAnalysisLogs.psm1 |
Adds and exports URI conversion helper. |
ProcessALCodeAnalysisLogs.ps1 |
Encodes SARIF artifact locations. |
ProcessALCodeAnalysisLogs.Test.ps1 |
Tests URI encoding behavior. |
RELEASENOTES.md |
Documents the fix. |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
Tests/ProcessALCodeAnalysisLogs.Test.ps1:278
- Specify UTF-8 explicitly when writing this JSON fixture.
Set-Contentdefaults differ between Windows PowerShell 5 and PowerShell 7, while this repository's JSON-processing convention requires explicit UTF-8 encoding.
$baseIssueContent | ConvertTo-Json -Depth 10 | Set-Content -Path $errorLogFile
mazhelez
approved these changes
Jul 24, 2026
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.
Why
When
ProcessALCodeAnalysisLogswrites the SARIF file it put the raw workspace-relative path straight intoresults[].locations[0].physicalLocation.artifactLocation.uri. SARIFartifactLocationURIs must be valid URI references, but BCApps paths routinely contain spaces (for example1.Setup Data/Foo.al,Contoso Helpers/...). A raw space is not a valid URI character, sogithub/codeql-action/upload-sariflogged thousands of'...' is not a valid URIwarnings and alerts could fail to map back to their files.What
Added a small
ConvertTo-SarifArtifactUrihelper that URI-encodes each/-separated path segment individually with[Uri]::EscapeDataString, preserving the/separators. So1.Setup Data/Foo.albecomes1.Setup%20Data/Foo.aland the path structure is unchanged.GenerateSARIFJsonnow runs the relative path through this helper only when writing theurifield; de-duplication still keys on the raw relative path, so dedup semantics are untouched.Verified live on a BCApps PR: after the fix, 0
not a valid URIwarnings.Changes
Actions/ProcessALCodeAnalysisLogs/ProcessALCodeAnalysisLogs.psm1: newConvertTo-SarifArtifactUrifunction (with comment-based help), exported from the module.Actions/ProcessALCodeAnalysisLogs/ProcessALCodeAnalysisLogs.ps1: encode only theuriline in the result object.Tests/ProcessALCodeAnalysisLogs.Test.ps1: an end-to-end test asserting the emitteduriis encoded (and that/is preserved), plus a unit-testContextfor the new function. Tests pass on both Windows PowerShell 5 and PowerShell 7.RELEASENOTES.md: release note describing the fix.Notes
This is split out of a larger changeset into its own PR: it contains only the SARIF URI fix, no performance/scaling change to
ProcessALCodeAnalysisLogsand notrackALAlertsInGitHubworkspace-compilation change.