Skip to content

Commit

Permalink
use strings.CutPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
icholy committed Apr 24, 2024
1 parent 1fc1d2b commit f19583a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions challenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ func (c *Challenge) SupportsQOP(qop string) bool {

// ParseChallenge parses the WWW-Authenticate header challenge
func ParseChallenge(s string) (*Challenge, error) {
if !IsDigest(s) {
s, ok := strings.CutPrefix(s, Prefix)

Check failure on line 37 in challenge.go

View workflow job for this annotation

GitHub Actions / build

undefined: strings.CutPrefix
if !ok {
return nil, errors.New("digest: invalid challenge prefix")
}
pp, err := param.Parse(s[len(Prefix):])
pp, err := param.Parse(s)
if err != nil {
return nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ type Credentials struct {

// ParseCredentials parses the Authorization header value into credentials
func ParseCredentials(s string) (*Credentials, error) {
if !IsDigest(s) {
s, ok := strings.CutPrefix(s, Prefix)

Check failure on line 29 in credentials.go

View workflow job for this annotation

GitHub Actions / build

undefined: strings.CutPrefix
if !ok {
return nil, errors.New("digest: invalid credentials prefix")
}
pp, err := param.Parse(s[len(Prefix):])
pp, err := param.Parse(s)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit f19583a

Please sign in to comment.