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

Simple file validation and HTML5 zip correction #4867

Merged
merged 4 commits into from
Jan 24, 2025

Conversation

rtibbles
Copy link
Member

@rtibbles rtibbles commented Jan 7, 2025

Summary

  • Adds simple validation of image, video, and audio files
  • Adds utility for creating predictable zip files that gives an exact MD5 match for those created by ricecooker
  • Adds validation for HTML5 files
  • Adds cleaning to process HTML5 files to remove unnecessary folder nesting
  • If index.html is not present, finds first available html file to use as entry point
  • Rezips all uploaded zip files as predictable zips to have parallel implementation to ricecooker

References

Fixes #4013

Reviewer guidance

I think the 'first available html file' might be better handled by asking the user which one they want to use, but this would require a lot more work to enable.

Testing this is best done by taking an existing HTML5 app and messing about with it, unzip it, put its contents in a bunch of nested folders, and then rezip it. If appropriate, rename the index.html to something else and make sure it still works (this will only work reliably if there are no other html files in the root of the zip).

@rtibbles rtibbles marked this pull request as draft January 7, 2025 18:47
@rtibbles rtibbles marked this pull request as ready for review January 7, 2025 20:18
Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM and manual QA checks out -- Test cases, covering all edge cases, gave extra detail on what the code was doing. Thanks @rtibbles!

@rtibbles rtibbles merged commit c7a35be into learningequality:unstable Jan 24, 2025
14 checks passed
@rtibbles rtibbles deleted the predictable_zips branch January 24, 2025 16:20
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.

Validate against and attempt fixing of incorrectly formatted HTML5 ZIPs
2 participants