Skip to content

fix: gracefully handle unexpected exif orientation types - #47509

Merged
kesselb merged 1 commit into
masterfrom
fix/exif-orientation-type
Aug 27, 2024
Merged

fix: gracefully handle unexpected exif orientation types#47509
kesselb merged 1 commit into
masterfrom
fix/exif-orientation-type

Conversation

@st3iny

@st3inyst3iny commented Aug 27, 2024

Copy link
Copy Markdown
Member

Summary

The member $exif['Orientation'] is a string sometimes which breaks generating previews. I added some code to make it more robust and cast it to an int if the orientation is numeric.

2024-08-27T04:50:23+00:00 Scanning folder /laraeva/files/Shared/Photos Ati/2015/2015-10-27
An unhandled exception has been thrown:
TypeError: OC_Image::getOrientation(): Return value must be of type int, string returned in /var/www/html/lib/private/legacy/OC_Image.php:485
Stack trace:
#0 /var/www/html/lib/private/legacy/OC_Image.php(519): OC_Image->getOrientation()
#1 /var/www/html/lib/private/Preview/Image.php(52): OC_Image->fixOrientation()
#2 /var/www/html/lib/private/Preview/GeneratorHelper.php(64): OC\Preview\Image->getThumbnail(Object(OC\Files\Node\File), 2048, 2048)

TODO

  • Probably tests

Checklist

Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
@st3inyst3iny self-assigned this Aug 27, 2024
@st3inyst3iny added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 27, 2024
@st3iny
st3iny marked this pull request as ready for review August 27, 2024 07:46
@st3iny

Copy link
Copy Markdown
MemberAuthor

/backport to stable30

@st3iny

Copy link
Copy Markdown
MemberAuthor

/backport to stable29

@st3iny

Copy link
Copy Markdown
MemberAuthor

/backport to stable28

@st3inyst3iny added this to the Nextcloud 31 milestone Aug 27, 2024
@kesselb
kesselb merged commit 11822de into masterAug 27, 2024
@kesselb
kesselb deleted the fix/exif-orientation-type branch August 27, 2024 13:59
@backportbot

This comment was marked as outdated.

@solracsf

Copy link
Copy Markdown
Member

/backport to stable29

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

An unhandled exception has been thrown while running

4 participants

@st3iny@solracsf@joshtrichards@kesselb