Skip to content

Commit

Permalink
🐛 Filename() panics when non-file URI is passed (konveyor#575) (konve…
Browse files Browse the repository at this point in the history
…yor#576)

Signed-off-by: Pranav Gaikwad <[email protected]>
Signed-off-by: Cherry Picker <[email protected]>

Signed-off-by: Pranav Gaikwad <[email protected]>
Signed-off-by: Cherry Picker <[email protected]>
Co-authored-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
konveyor-ci-bot[bot] and pranavgaikwad authored Apr 15, 2024
1 parent fb7c81e commit 3e35a11
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"context"
"fmt"
"net/url"
"os"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -414,6 +415,10 @@ func processRule(ctx context.Context, rule Rule, ruleCtx ConditionContext, log l
func (r *ruleEngine) getRelativePathForViolation(fileURI uri.URI) (uri.URI, error) {
var sourceLocation string
if fileURI != "" {
u, err := url.ParseRequestURI(string(fileURI))
if err != nil || u.Scheme != uri.FileScheme {
return fileURI, nil
}
file := fileURI.Filename()
// get the correct source from config
for _, locationPrefix := range r.locationPrefixes {
Expand Down

0 comments on commit 3e35a11

Please sign in to comment.