Skip to content

Commit

Permalink
support python libraries with + in the file name
Browse files Browse the repository at this point in the history
  • Loading branch information
levpachmanov committed Mar 25, 2024
1 parent 0093dee commit 0427432
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
8 changes: 7 additions & 1 deletion utils/pythonutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pythonutils
import (
"errors"
"fmt"
"net/url"
"path/filepath"
"regexp"
"strings"
Expand Down Expand Up @@ -307,5 +308,10 @@ func extractFileNameFromRegexCaptureGroup(pattern *gofrogcmd.CmdOutputPattern) (
if lastSlashIndex == -1 {
return filePath
}
return filePath[lastSlashIndex+1:]
latComponent := filePath[lastSlashIndex+1:]
unescapedComponent, err := url.QueryUnescape(latComponent)
if err != nil {
return latComponent
}
return unescapedComponent
}
14 changes: 14 additions & 0 deletions utils/pythonutils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ Collecting PyYAML==5.1.2 (from jfrog-python-example==1.0)
Installing build dependencies: started`,
expectedCapture: `PyYAML-5.1.2.tar.gz`,
},
{
name: "Downloading - multi line captures",
startCapturePattern: startDownloadingPattern,
captureGroupPattern: downloadingCaptureGroup,
endCapturePattern: endPattern,
text: ` Preparing metadata (pyproject.toml): finished with status 'done'
Collecting PyYAML==5.1.2 (from jfrog-python-example==1.0)
Downloading http://localhost:8081/artifactory/api/pypi/cli-pypi-virtual-1698
829558/packages/packages/e3/e8/b3212641ee2718d556df0f23f78de8303f068fe29cdaa7a91018849
582fe/PyYAML-5.1.2%2Bsp1.tar.gz (265 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 265.0/265.0 kB 364.4 MB/s eta 0:00:00
Installing build dependencies: started`,
expectedCapture: `PyYAML-5.1.2+sp1.tar.gz`,
},
}

for _, testCase := range tests {
Expand Down

0 comments on commit 0427432

Please sign in to comment.