Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gracefully handle unexpected exif orientation types #47509

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

st3iny
Copy link
Member

@st3iny st3iny commented Aug 27, 2024

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>
@st3iny st3iny self-assigned this Aug 27, 2024
@st3iny st3iny 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
Member Author

st3iny commented Aug 27, 2024

/backport to stable30

@st3iny
Copy link
Member Author

st3iny commented Aug 27, 2024

/backport to stable29

@st3iny
Copy link
Member Author

st3iny commented Aug 27, 2024

/backport to stable28

@st3iny st3iny added this to the Nextcloud 31 milestone Aug 27, 2024
@kesselb kesselb merged commit 11822de into master Aug 27, 2024
175 checks passed
@kesselb kesselb deleted the fix/exif-orientation-type branch August 27, 2024 13:59

This comment was marked as outdated.

@solracsf
Copy link
Member

/backport to stable29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ☑️ Done
Development

Successfully merging this pull request may close these issues.

An unhandled exception has been thrown while running
4 participants