From 504e0da8f5d538955a92f790d36c7493978196a5 Mon Sep 17 00:00:00 2001 From: Lev Pachmanov Date: Wed, 3 Apr 2024 17:21:38 +0300 Subject: [PATCH] PR --- utils/pythonutils/utils.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/utils/pythonutils/utils.go b/utils/pythonutils/utils.go index a2f9bab9..8c676e61 100644 --- a/utils/pythonutils/utils.go +++ b/utils/pythonutils/utils.go @@ -308,10 +308,12 @@ func extractFileNameFromRegexCaptureGroup(pattern *gofrogcmd.CmdOutputPattern) ( if lastSlashIndex == -1 { return filePath } - latComponent := filePath[lastSlashIndex+1:] - unescapedComponent, err := url.QueryUnescape(latComponent) - if err != nil { - return latComponent + lastComponent := filePath[lastSlashIndex+1:] + // Unescape the last component, for example 'PyYAML-5.1.2%2Bsp1.tar.gz' -> 'PyYAML-5.1.2+sp1.tar.gz'. + unescapedComponent, _ := url.QueryUnescape(lastComponent) + if unescapedComponent == "" { + // Couldn't escape, will use the raw string + return lastComponent } return unescapedComponent }