-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaner refactoring to determineManifestConversion
Signed-off-by: Brandon Lum <[email protected]>
- Loading branch information
Showing
4 changed files
with
39 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package copy | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/containers/image/v5/types" | ||
) | ||
|
||
// isOciEncrypted returns if a mediatype is encrypted | ||
// This function will be moved to be part of OCI spec when adopted. | ||
func isOciEncrypted(mediatype string) bool { | ||
return strings.HasSuffix(mediatype, "+encrypted") | ||
} | ||
|
||
// isEncrypted checks if an image is encrypted | ||
func isEncrypted(i types.Image) bool { | ||
layers := i.LayerInfos() | ||
for _, l := range layers { | ||
if isOciEncrypted(l.MediaType) { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters