Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	utils/utils.go
  • Loading branch information
omerzi committed Jul 18, 2023
2 parents f750025 + c761a2d commit e1d57bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions artifactory/services/fspatterns/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"strings"

biutils "github.com/jfrog/build-info-go/utils"
serviceutils "github.com/jfrog/jfrog-client-go/artifactory/services/utils"
"github.com/jfrog/jfrog-client-go/utils"
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"github.com/jfrog/jfrog-client-go/utils/io/fileutils"
Expand All @@ -30,14 +29,15 @@ func ListFiles(rootPath string, isRecursive, includeDirs, isSymlink bool, exclud
return filterFiles(paths, excludePathPattern)
}

// Transform to regexp and prepare Exclude patterns to be used
func PrepareExcludePathPattern(params serviceutils.FileGetter) string {
// Transform to regexp and prepare Exclude patterns to be used, exclusion patterns must be absolute paths.
func PrepareExcludePathPattern(exclusions []string, patternType utils.PatternType, isRecursive bool) string {
excludePathPattern := ""
for _, singleExclusion := range params.GetExclusions() {

for _, singleExclusion := range exclusions {
if len(singleExclusion) > 0 {
singleExclusion = utils.ReplaceTildeWithUserHome(singleExclusion)
singleExclusion = utils.ConvertLocalPatternToRegexp(singleExclusion, params.GetPatternType())
if params.IsRecursive() && strings.HasSuffix(singleExclusion, fileutils.GetFileSeparator()) {
singleExclusion = utils.ConvertLocalPatternToRegexp(singleExclusion, patternType)
if isRecursive && strings.HasSuffix(singleExclusion, fileutils.GetFileSeparator()) {
singleExclusion += "*"
}
excludePathPattern += fmt.Sprintf(`(%s)|`, singleExclusion)
Expand Down
2 changes: 1 addition & 1 deletion artifactory/services/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func addEscapingParenthesesForUpload(pattern, target, targetPathInArchive string
}

func scanFilesByPattern(uploadParams UploadParams, rootPath string, progressMgr ioutils.ProgressMgr, vcsCache *clientutils.VcsCache, dataHandlerFunc UploadDataHandlerFunc) error {
excludePathPattern := fspatterns.PrepareExcludePathPattern(uploadParams)
excludePathPattern := fspatterns.PrepareExcludePathPattern(uploadParams.Exclusions, uploadParams.GetPatternType(), uploadParams.IsRecursive())
patternRegex, err := regexp.Compile(uploadParams.GetPattern())
if errorutils.CheckError(err) != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
const (
Development = "development"
Agent = "jfrog-client-go"
Version = "1.31.1"
Version = "1.31.2"
)

// In order to limit the number of items loaded from a reader into the memory, we use a buffers with this size limit.
Expand Down

0 comments on commit e1d57bd

Please sign in to comment.