Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions auth/kbase_auth_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"fmt"
"io"
"net/http"
"strings"
"time"
)

Expand Down Expand Up @@ -58,7 +59,6 @@ type KBaseAuthServerOption func(*KBaseAuthServerConfig)
// options can be used to modify the default configuration, and are typically
// used for testing with a mock server
func NewKBaseAuthServer(accessToken string, options ...KBaseAuthServerOption) (*KBaseAuthServer, error) {

// set up default configuration
cfg := KBaseAuthServerConfig{
BaseURL: kbaseURL,
Expand Down Expand Up @@ -165,7 +165,12 @@ func kbaseAuthError(response *http.Response) error {
if mErr == nil {
var result kbaseAuthErrorResponse
mErr = json.Unmarshal(body, &result)
if mErr == nil {
if mErr != nil {
if strings.Contains(string(body), "cloudflare") {
err = fmt.Errorf("KBase Auth error (%d): %s", response.StatusCode,
"Authenticator is protected by a Cloudflare challenge")
}
} else {
if len(result.Message) > 0 {
err = fmt.Errorf("KBase Auth error (%d): %s", response.StatusCode,
result.Message)
Expand Down
13 changes: 12 additions & 1 deletion databases/jdp/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ func (db *Database) Search(orcid string, params databases.SearchParameters) (dat
pageNumber, pageSize := pageNumberAndSize(params.Pagination.Offset, params.Pagination.MaxNum)

p := url.Values{}
p.Add("q", params.Query)
if params.Query != "" {
p.Add("q", params.Query)
}
switch params.Status {
case databases.SearchFileStatusStaged:
p.Add(`ff[file_status]`, "RESTORED")
Expand Down Expand Up @@ -809,6 +811,15 @@ func (db Database) addSpecificSearchParameters(params map[string]any, p *url.Val
}
}
p.Add(name, fmt.Sprintf("%d", value))
case "datasets": // specific JGI datasets requested
var value string
if value, ok = jsonValue.(string); !ok {
return &databases.InvalidSearchParameter{
Database: "JDP",
Message: "Invalid JDP dataset(s) requested (must be comma-delimited string)",
}
}
p.Add(name, strings.TrimSpace(value))
case "extra": // comma-separated additional fields requested
var value string
if value, ok = jsonValue.(string); !ok {
Expand Down
4 changes: 2 additions & 2 deletions services/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

// Version numbers
var majorVersion = 0
var minorVersion = 12
var patchVersion = 1
var minorVersion = 13
var patchVersion = 0

// Version string
var version = fmt.Sprintf("%d.%d.%d", majorVersion, minorVersion, patchVersion)
Loading