Fix for #570
This commit is contained in:
parent
0c9bd87602
commit
661a573bf5
@ -725,8 +725,10 @@ class PhotoInfo:
|
||||
self._uti_original = self.uti
|
||||
elif self._db._photos_ver >= 7:
|
||||
# Monterey+
|
||||
self._uti_original = get_uti_for_extension(
|
||||
pathlib.Path(self.original_filename).suffix
|
||||
# there are some cases with UTI_original is None (photo imported with no extension) so fallback to UTI and hope it's right
|
||||
self._uti_original = (
|
||||
get_uti_for_extension(pathlib.Path(self.original_filename).suffix)
|
||||
or self.uti
|
||||
)
|
||||
else:
|
||||
self._uti_original = self._info["UTI_original"]
|
||||
@ -1025,7 +1027,7 @@ class PhotoInfo:
|
||||
@property
|
||||
def israw(self):
|
||||
"""returns True if photo is a raw image. For images with an associated RAW+JPEG pair, see has_raw"""
|
||||
return "raw-image" in self.uti_original
|
||||
return "raw-image" in self.uti_original if self.uti_original else False
|
||||
|
||||
@property
|
||||
def raw_original(self):
|
||||
|
||||
@ -520,7 +520,8 @@ class PhotoAsset:
|
||||
== Photos.PHAssetResourceTypeAlternatePhoto
|
||||
):
|
||||
data = self._request_resource_data(resource)
|
||||
ext = pathlib.Path(self.raw_filename).suffix[1:]
|
||||
suffix = pathlib.Path(self.raw_filename).suffix
|
||||
ext = suffix[1:] if suffix else ""
|
||||
break
|
||||
else:
|
||||
raise PhotoKitExportError(
|
||||
|
||||
@ -591,6 +591,9 @@ def get_preferred_uti_extension(uti):
|
||||
def get_uti_for_extension(extension):
|
||||
"""get UTI for a given file extension"""
|
||||
|
||||
if not extension:
|
||||
return None
|
||||
|
||||
# accepts extension with or without leading 0
|
||||
if extension[0] == ".":
|
||||
extension = extension[1:]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user