Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #34 from gmgigi96/fix-cookie-password-public-link
Browse files Browse the repository at this point in the history
Do not complain if password is not provided in cookie for public links
  • Loading branch information
gmgigi96 authored Oct 17, 2022
2 parents 61486e9 + be2fb18 commit 22346fb
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ func (s *strategy) GetCredentials(w http.ResponseWriter, r *http.Request) (*auth

sharePassword := basicAuthPasswordPrefix
if s.c.UseCookies {
password, err := r.Cookie("password")
if err != nil {
return nil, errors.Wrap(err, "error getting password from cookie")
if password, err := r.Cookie("password"); err == nil {
sharePassword += password.Value
return &auth.Credentials{Type: "publicshares", ClientID: token, ClientSecret: sharePassword}, nil
}
sharePassword += password.Value
return &auth.Credentials{Type: "publicshares", ClientID: token, ClientSecret: sharePassword}, nil
}

// We can ignore the username since it is always set to "public" in public shares.
Expand Down

0 comments on commit 22346fb

Please sign in to comment.