Skip to content

Properly validate files before upload #244

Open
@ivanistheone

Description

@ivanistheone
  • ricecooker version: 0.6.39
  • Python version: 3.7
  • Operating System: macOS

Problem

Currently Ricecooker will allow the upload of empty or otherwise invalid files to Studio. The validation performed is only "shallow validation" to make sure file extension is OK.

Proposed solution

We could follow the example of ThumbnailFile to implement "deep validation" checks as part of the process_file method of each file type:

  • PDF try to read using PyPDF2
  • ePub try to open .epub file with ebooklib.epub.read_epub
  • audio and video could check codecs with ffmpeg[1,2,3]
  • Check that files are not too large and give a warning.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions