Skip to content

Commit 113dd2b

Browse files
committed
fix: remove pre-parse vcsurl call that ignored --timeout in the CLI
The check also rejected valid publiccode.yml files on unrecognized hosts: the parser already falls back to the original URL when the provider is not recognized, so the early exit was wrong.
1 parent c9fbfe8 commit 113dd2b

2 files changed

Lines changed: 1 addition & 15 deletions

File tree

publiccode-parser/publiccode_parser.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import (
88
"os"
99
"runtime/debug"
1010

11-
"github.com/alranel/go-vcsurl/v2"
1211
publiccode "github.com/italia/publiccode-parser-go/v5"
13-
urlutil "github.com/italia/publiccode-parser-go/v5/internal"
1412
)
1513

1614
var (
@@ -76,14 +74,6 @@ func main() {
7674

7775
publiccodeFile := flag.Args()[0]
7876

79-
if ok, url := urlutil.IsValidURL(publiccodeFile); ok {
80-
// supplied argument looks like an URL
81-
if vcsurl.GetRawFile(url) == nil {
82-
fmt.Fprintf(os.Stderr, "Code hosting provider not supported for %s\n", url)
83-
os.Exit(1)
84-
}
85-
}
86-
8777
config := publiccode.ParserConfig{BaseURL: *localBasePathPtr}
8878
config.DisableNetwork = *disableNetworkPtr
8979
config.DisableExternalChecks = *disableExternalChecksPtr

validations.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,11 @@ func (p *Parser) isReachable(u url.URL) (bool, error) {
9191
return false, errMissingURLScheme
9292
}
9393

94-
r, err := p.httpclient.GetURL(u.String(), getHeaderFromDomain(p.domain, u.String()))
94+
_, err := p.httpclient.GetURL(u.String(), getHeaderFromDomain(p.domain, u.String()))
9595
if err != nil {
9696
return false, fmt.Errorf("HTTP GET failed for %s: %w", u.String(), err)
9797
}
9898

99-
if r.Status.Code != 200 {
100-
return false, fmt.Errorf("HTTP GET returned %d for %s; 200 was expected", r.Status.Code, u.String()) //nolint:err113,lll // dynamic message with response context
101-
}
102-
10399
return true, nil
104100
}
105101

0 commit comments

Comments
 (0)