@@ -271,6 +271,16 @@ func (r *artifactV4Routes) createArtifact(ctx *ArtifactContext) {
271
271
272
272
artifactName := req .Name
273
273
274
+ safeRunPath := safeResolve (r .baseDir , fmt .Sprint (runID ))
275
+ safePath := safeResolve (safeRunPath , artifactName )
276
+ safePath = safeResolve (safePath , artifactName + ".zip" )
277
+ file , err := r .fs .OpenWritable (safePath )
278
+
279
+ if err != nil {
280
+ panic (err )
281
+ }
282
+ file .Close ()
283
+
274
284
respData := CreateArtifactResponse {
275
285
Ok : true ,
276
286
SignedUploadUrl : r .buildArtifactURL ("UploadArtifact" , artifactName , runID ),
@@ -292,12 +302,7 @@ func (r *artifactV4Routes) uploadArtifact(ctx *ArtifactContext) {
292
302
safePath := safeResolve (safeRunPath , artifactName )
293
303
safePath = safeResolve (safePath , artifactName + ".zip" )
294
304
295
- file , err := func () (WritableFile , error ) {
296
- if comp == "appendBlock" {
297
- return r .fs .OpenAppendable (safePath )
298
- }
299
- return r .fs .OpenWritable (safePath )
300
- }()
305
+ file , err := r .fs .OpenAppendable (safePath )
301
306
302
307
if err != nil {
303
308
panic (err )
@@ -317,6 +322,7 @@ func (r *artifactV4Routes) uploadArtifact(ctx *ArtifactContext) {
317
322
if err != nil {
318
323
panic (err )
319
324
}
325
+ file .Close ()
320
326
ctx .JSON (http .StatusCreated , "appended" )
321
327
case "blocklist" :
322
328
ctx .JSON (http .StatusCreated , "created" )
0 commit comments