Skip to content

Conversation

@JammingBen
Copy link
Contributor

Description

Changed the way how preview thumbnails are being rendered so they will be rendered properly for file versions.

Related Issue

Screenshots (if appropriate):

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@owncloud owncloud deleted a comment from update-docs bot May 26, 2021
@JammingBen JammingBen self-assigned this May 26, 2021
@JammingBen JammingBen requested a review from jvillafanez May 26, 2021 10:02
@jvillafanez
Copy link
Member

I think we should put a limit there to avoid loading a 500MB+ file into memory. I don't know how the native functions have been loading the image, but it wasn't our responsibility. If we're going to load the whole file into memory, I think we must check the filesize before to ensure it's within the limits.

@AlexAndBear
Copy link

@jvillafanez what is an appropriate file size? Any default image/placeholder to render ?

@JammingBen
Copy link
Contributor Author

What do you suggest for a limit? Or make it configurable even?

@AlexAndBear
Copy link

AlexAndBear commented May 26, 2021

https://github.com/owncloud/core/blob/9a6df29dc746ba8f4c768a4571c058dc3c890e4f/lib/private/Preview/Image.php L39 already there..

@AlexAndBear AlexAndBear self-requested a review May 26, 2021 11:34
@jvillafanez
Copy link
Member

https://github.com/owncloud/core/blob/9a6df29dc746ba8f4c768a4571c058dc3c890e4f/lib/private/Preview/Image.php L39 already there..

Is it just for the thumbnail? I mean, It seems to me you'll still load a 1GB file into memory and then reject the thumbnail generation because the file is too big.

Reusing that config key makes sense though.

@JammingBen
Copy link
Contributor Author

Is it just for the thumbnail? I mean, It seems to me you'll still load a 1GB file into memory and then reject the thumbnail generation because the file is too big.

I'm pretty sure this is just for the thumbnail, yes. I get your point, but this is not related to this issue, is it? I mean, we would need to check other places where the image gets loaded into memory initially (if so). But the preview thumbnails seem to be safe because of the if-condition here.

@jvillafanez
Copy link
Member

https://github.com/owncloud/core/pull/38778/files#diff-ff6994338643431270cf761760b151580f971dd03f7df4ae572ca41f50ef8fb5R48 is one of those places, unless I'm wrong.
I'm fine assuming that's the only place we need to check

@JammingBen
Copy link
Contributor Author

Yes, but the if-clause which returns if the limit exceeds it literally 5 lines above that statement 😄 So there is not way we exceed the limit here because of this change.

@jvillafanez
Copy link
Member

Sometimes I just need to scroll further... I thought the changes were elsewhere 🐧
Ok, nothing more from me. 👍

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@AlexAndBear AlexAndBear merged commit 96bb1a3 into master May 26, 2021
@delete-merged-branch delete-merged-branch bot deleted the fix-versions-preview branch May 26, 2021 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preview of versions doesn't show

4 participants