Fix upload artifact (#852)

* fixed repository to check for file existence before trying to get the artifact
* added additional existence checks before retrieving the artifact from repository

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch-si.com>
This commit is contained in:
Bondar Bogdan
2019-06-13 16:59:21 +02:00
committed by Jeroen Laverman
parent 34fc7a7012
commit 568848bb27
2 changed files with 14 additions and 10 deletions

View File

@@ -64,7 +64,9 @@ public class MgmtDownloadResource implements MgmtDownloadRestApi {
AbstractDbArtifact artifact = null;
if (DownloadType.BY_SHA1 == artifactCache.getDownloadType()) {
artifact = artifactRepository.getArtifactBySha1(tenant, artifactCache.getId());
artifact = artifactRepository.existsByTenantAndSha1(tenant, artifactCache.getId())
? artifactRepository.getArtifactBySha1(tenant, artifactCache.getId())
: null;
} else {
LOGGER.warn("Download Type {} not supported", artifactCache.getDownloadType());
}