When there're no artifacts collected, disable "Download" button and do not generate an empty .zip
Summary
When an artifact pattern has been defined but there's no matching files to upload in a job:
Uploading artifacts...
WARNING: ./*.txt: no matching files
Uploading artifacts to coordinator... ok id=<job_id> responseStatus=201 Created token=<token>
Job succeeded
GitLab CI still allows to download the artifact archive.
Steps to reproduce
- Define a pattern that won't match any generated files on the job.
- Run the pipeline
- Click on "Download" in the Job Artifacts section or
wget https://gitlab.com/<user>/<project>/builds/<job_id>/artifacts/download
What is the current bug behavior?
The "Download" button is available everywhere (i.e. pipeline, job, artifact explorer views...), even when there's nothing to be downloaded:
And it allows to download the zipped contents; which will cause an error with OS X's Archive Utility as the file cannot be expanded:
What is the expected correct behavior?
- The "Download" button could include a tooltip explaining there was no matching files generated in the job to prevent downloading 22 bytes
.zipfiles with no content. - The API endpoint to download the artifacts (
/<job_id>/artifacts/download) could return a204: No Contentwhen queried.
Output of checks
This bug happens on GitLab.com

