From d631e35955bd387daf0d80e392710aad66fa928d Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Aug 14 2019 09:37:55 +0000 Subject: allow archive import only for types from build Fixes: https://pagure.io/koji/issue/1609 --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 34bd435..ee9695e 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -9653,6 +9653,10 @@ class RootExports(object): context.session.assertPerm('image-import') else: raise koji.GenericError('unsupported archive type: %s' % type) + btypes = to_list(get_build_type(buildinfo).keys()) + if type not in btypes: + raise koji.GenericError('mixing build types, build: %s, archive: %s' % (sorted(btypes), type)) + buildinfo = get_build(buildinfo, strict=True) fullpath = '%s/%s' % (koji.pathinfo.work(), filepath) import_archive(fullpath, buildinfo, type, typeInfo)