Fix the jpeg check on macOS 11 and later

Fix #151.
This commit is contained in:
Damiano Galassi committed 2026-09-25 07:48:42 +02:00
1 parent ce011a4d37
commit 40107a9db1
1 file changed
+2 -2
@@ -905,12 +905,12 @@ class MovieViewController: PropertyView, NSTableViewDataSource, ExpandedTableVie
private func add(artworks: [Any], toIndexPath: IndexPath) -> Bool {
let items = artworks.compactMap { (artwork: Any) -> MP42Image? in
if let url = artwork as? URL {
let value = try? url.resourceValues(forKeys: [URLResourceKey.typeIdentifierKey])
var isJpeg = false
if #available(macOS 11, *) {
let value = try? url.resourceValues(forKeys: [URLResourceKey.contentTypeKey])
isJpeg = value?.contentType?.conforms(to: .jpeg) ?? false
} else {
let value = try? url.resourceValues(forKeys: [URLResourceKey.typeIdentifierKey])
if let type = value?.typeIdentifier, UTTypeConformsTo(type as CFString, "public.jpeg" as CFString) {
isJpeg = true
}