Skip to content

[11.11] Fix double encoding of job name in artifacts download #773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Api/Jobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function artifacts($project_id, int $job_id)
public function artifactsByRefName($project_id, string $ref_name, string $job_name)
{
return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/download', [
'job' => self::encodePath($job_name),
'job' => $job_name,
])->getBody();
}

Expand All @@ -166,7 +166,7 @@ public function artifactsByRefName($project_id, string $ref_name, string $job_na
public function artifactByRefName($project_id, string $ref_name, string $job_name, string $artifact_path)
{
return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/raw/'.self::encodePath($artifact_path), [
'job' => self::encodePath($job_name),
'job' => $job_name,
])->getBody();
}

Expand Down
8 changes: 4 additions & 4 deletions tests/Api/JobsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ public function shouldGetArtifactsByRefName(): void
$api->expects($this->once())
->method('getAsResponse')
->with('projects/1/jobs/artifacts/master/download', [
'job' => 'job_name',
'job' => 'job name',
])
->will($this->returnValue($returnedStream))
;

$this->assertEquals('foobar', $api->artifactsByRefName(1, 'master', 'job_name')->getContents());
$this->assertEquals('foobar', $api->artifactsByRefName(1, 'master', 'job name')->getContents());
}

/**
Expand All @@ -189,11 +189,11 @@ public function shouldGetArtifactByRefName(): void
$api->expects($this->once())
->method('getAsResponse')
->with('projects/1/jobs/artifacts/master/raw/artifact_path', [
'job' => 'job_name',
'job' => 'job name',
])
->will($this->returnValue($returnedStream))
;
$this->assertEquals('foobar', $api->artifactByRefName(1, 'master', 'job_name', 'artifact_path')->getContents());
$this->assertEquals('foobar', $api->artifactByRefName(1, 'master', 'job name', 'artifact_path')->getContents());
}

/**
Expand Down