88 "github.com/jfrog/jfrog-client-go/artifactory/services/utils"
99 "github.com/jfrog/jfrog-client-go/auth"
1010 "github.com/jfrog/jfrog-client-go/http/jfroghttpclient"
11- clientutils "github.com/jfrog/jfrog-client-go/utils"
1211 "github.com/jfrog/jfrog-client-go/utils/errorutils"
1312 "github.com/jfrog/jfrog-client-go/utils/log"
1413)
@@ -35,17 +34,21 @@ func (ps *PromoteService) BuildPromote(promotionParams PromotionParams) error {
3534 log .Info (message )
3635
3736 promoteUrl := ps .ArtDetails .GetUrl ()
38- restApi := path .Join ("api/build/promote/" , promotionParams . GetBuildName (), promotionParams . GetBuildNumber () )
37+ restApi := path .Join ("api/build/promote/" )
3938
4039 queryParams := make (map [string ]string )
4140 if promotionParams .ProjectKey != "" {
4241 queryParams ["project" ] = promotionParams .ProjectKey
4342 }
4443
45- requestFullUrl , err := clientutils .BuildUrl (promoteUrl , restApi , queryParams )
44+ buildName := promotionParams .GetBuildName ()
45+ buildNumber := promotionParams .GetBuildNumber ()
46+
47+ requestURLWithEscapedSlash , err := utils .BuildUrlWithEscapingSlash (promoteUrl , restApi , buildName , buildNumber , queryParams )
4648 if err != nil {
4749 return err
4850 }
51+
4952 props , err := utils .ParseProperties (promotionParams .GetProperties ())
5053 if err != nil {
5154 return err
@@ -69,11 +72,11 @@ func (ps *PromoteService) BuildPromote(promotionParams PromotionParams) error {
6972 httpClientsDetails := ps .ArtDetails .CreateHttpClientDetails ()
7073 utils .SetContentType ("application/vnd.org.jfrog.artifactory.build.PromotionRequest+json" , & httpClientsDetails .Headers )
7174
72- resp , body , err := ps .client .SendPost (requestFullUrl , requestContent , & httpClientsDetails )
75+ resp , body , err := ps .client .SendPost (requestURLWithEscapedSlash , requestContent , & httpClientsDetails )
7376 if err != nil {
7477 return err
7578 }
76-
79+
7780 if err = errorutils .CheckResponseStatusWithBody (resp , body , http .StatusOK ); err != nil {
7881 return err
7982 }
0 commit comments