Skip to content

Commit

Permalink
Merge branch 'master' into batch-job-status
Browse files Browse the repository at this point in the history
  • Loading branch information
shtripat authored May 10, 2024
2 parents 2071ae6 + fdb36ac commit 7ccec95
Show file tree
Hide file tree
Showing 5 changed files with 877 additions and 926 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
GO111MODULE: on
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.22.x]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
make
make test-race
make verify
make crosscompile
./functional-tests.sh
vetchecks: # Run vet checks against one version.
env:
CGO_ENABLED: 0
Expand All @@ -69,7 +69,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.x
go-version: 1.22.x

- name: Checkout code
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.10
go-version: 1.22.3
check-latest: true
- name: Get official govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
Expand Down
25 changes: 24 additions & 1 deletion cmd/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"bytes"
"context"
"fmt"
"net/http"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -426,7 +427,7 @@ func matchFind(ctx *findContext, fileContent contentMessage) (match bool) {
match = int64(ctx.smallerSize) > fileContent.Size
}
if match && len(ctx.matchMeta) > 0 {
match = matchRegexMaps(ctx.matchMeta, fileContent.Metadata)
match = matchMetadataRegexMaps(ctx.matchMeta, fileContent.Metadata)
}
if match && len(ctx.matchTags) > 0 {
match = matchRegexMaps(ctx.matchTags, fileContent.Tags)
Expand Down Expand Up @@ -512,3 +513,25 @@ func matchRegexMaps(m map[string]*regexp.Regexp, v map[string]string) bool {
}
return true
}

// matchMetadataRegexMaps will check if all regexes in 'm' match values in 'v' with the same key.
// If a regex is nil, it must either not exist in v or have a 0 length value.
func matchMetadataRegexMaps(m map[string]*regexp.Regexp, v map[string]string) bool {
for k, reg := range m {
if reg == nil {
if v[k] != "" {
return false
}
// Does not exist or empty, that is fine.
continue
}
val, ok := v[k]
if !ok {
val, ok = v[http.CanonicalHeaderKey(fmt.Sprintf("X-Amz-Meta-%s", k))]
}
if !ok || !reg.MatchString(val) {
return false
}
}
return true
}
2 changes: 1 addition & 1 deletion cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var globalFlags = []cli.Flag{
Name: "disable-pager, dp",
Usage: "disable mc internal pager and print to raw stdout",
EnvVar: envPrefix + globalDisablePagerEnv,
Hidden: true,
Hidden: false,
},
cli.BoolFlag{
Name: "no-color",
Expand Down
Loading

0 comments on commit 7ccec95

Please sign in to comment.