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

Validate maximum file size after converting audio/video file for tipline content #2046

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

caiosba
Copy link
Contributor

@caiosba caiosba commented Sep 23, 2024

Description

We validate the size of a file uploaded to be the header of a newsletter or resource. But, depending on the file (for example, videos and audios) they get converted to the formats and codecs accepted by WhatsApp. It’s important to also validate the file size after converting, since in some (rare) cases they can be larger than the original file. For example, when the input file is a video that uses the H.265 codec, which is usually much lighter than the H.264 output codec.

Fixes: CV2-5326.

How has this been tested?

TDD. I added a unit test that is able to reproduce the issue. The test uses as input a H.265 video that has size ~300KB, but 1.6 MB after converting to H.264. The test sets the maximum size to 1 MB.

Checklist

  • I have performed a self-review of my own code
  • I have added unit and feature tests, if the PR implements a new feature or otherwise would benefit from additional testing
  • I have added regression tests, if the PR fixes a bug
  • I have added logging, exception reporting, and custom tracing with any additional information required for debugging
  • I considered secure coding practices when writing this code. Any security concerns are noted above.
  • I have commented my code in hard-to-understand areas, if any
  • I have made needed changes to the README
  • My changes generate no new warnings
  • If I added a third party module, I included a rationale for doing so and followed our current guidelines

…ine content.

We validate the size of a file uploaded to be the header of a newsletter or resource. But, depending on the file (for example, videos and audios) they get converted to the formats and codecs accepted by WhatsApp. It’s important to also validate the file size after converting, since in some (rare) cases they can be larger than the original file. For example, when the input file is a video that uses the H.265 codec, which is usually much lighter than the H.264 output codec.

Fixes: CV2-5326.
@caiosba caiosba merged commit 637d04e into develop Sep 23, 2024
10 checks passed
@caiosba caiosba deleted the fix/CV2-5326-validate-video-size-after-converting branch September 23, 2024 17:00
Copy link

sentry-io bot commented Sep 23, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TiplineContentMultimedia::ConvertedFileTooLarge: Converted file for tipline content is too large Sidekiq/Sidekiq::Extensions::DelayedClass View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants