@@ -29,6 +29,7 @@ export default async (pluginConfig, context) => {
29
29
const assetsList = [ ] ;
30
30
const projectPath = getProjectPath ( context , gitlabUrl , repositoryUrl ) ;
31
31
const encodedProjectPath = encodeURIComponent ( projectPath ) ;
32
+ const projectApiUrl = urlJoin ( gitlabApiUrl , `/projects/${ encodedProjectPath } ` ) ;
32
33
const encodedGitTag = encodeURIComponent ( gitTag ) ;
33
34
const encodedVersion = encodeURIComponent ( version ) ;
34
35
const apiOptions = {
@@ -114,8 +115,8 @@ export default async (pluginConfig, context) => {
114
115
const encodedLabel = encodeURIComponent ( label ) ;
115
116
// https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-package-file
116
117
uploadEndpoint = urlJoin (
117
- gitlabApiUrl ,
118
- `/projects/ ${ encodedProjectPath } / packages/generic/release/${ encodedVersion } /${ encodedLabel } ?${
118
+ projectApiUrl ,
119
+ `packages/generic/release/${ encodedVersion } /${ encodedLabel } ?${
119
120
status ? `status=${ status } &` : ""
120
121
} select=package_file`
121
122
) ;
@@ -131,16 +132,16 @@ export default async (pluginConfig, context) => {
131
132
132
133
// https://docs.gitlab.com/ee/user/packages/generic_packages/#download-package-file
133
134
const url = urlJoin (
134
- gitlabApiUrl ,
135
- `/projects/ ${ encodedProjectPath } / packages/generic/release/${ encodedVersion } /${ encodedLabel } `
135
+ projectApiUrl ,
136
+ `packages/generic/release/${ encodedVersion } /${ encodedLabel } `
136
137
) ;
137
138
138
139
assetsList . push ( { label, alt : "release" , url, type : "package" , filepath } ) ;
139
140
140
141
logger . log ( "Uploaded file: %s (%s)" , url , response . file . url ) ;
141
142
} else {
142
143
// Handle normal assets
143
- uploadEndpoint = urlJoin ( gitlabApiUrl , `/projects/ ${ encodedProjectPath } / uploads` ) ;
144
+ uploadEndpoint = urlJoin ( projectApiUrl , " uploads" ) ;
144
145
145
146
debug ( "POST-ing the file %s to %s" , file , uploadEndpoint ) ;
146
147
@@ -167,7 +168,7 @@ export default async (pluginConfig, context) => {
167
168
168
169
debug ( "Create a release for git tag %o with commit %o" , gitTag , gitHead ) ;
169
170
170
- const createReleaseEndpoint = urlJoin ( gitlabApiUrl , `/projects/ ${ encodedProjectPath } / releases` ) ;
171
+ const createReleaseEndpoint = urlJoin ( projectApiUrl , " releases" ) ;
171
172
172
173
const json = {
173
174
/* eslint-disable camelcase */
0 commit comments