Lumieducation/H5P-Nodejs-library

Check uploaded (content) files

Open

Aperta il 30 ago 2019

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)TypeScript (198 star) (104 fork)auto 404
H5P-Editorenhancementgood first issue

Descrizione

Files uploaded through the AJAX endpoint (images, video etc.) need to be check whether they are valid:

  • the extension must be in H5PEditorConfig.contentWhitelist
  • the file must be smaller than H5PEditorConfig.maxFileSize
  • the package it is added to must not have a greater total size than H5PEditorConfig.maxTotalSize

There are further checks in h5p-editor-php-library:h5p-editor-file.class.php:

  • check if field type & mime-type match
  • check if mime-type is allowed
    • if image (check by mime type): - only allow png,jpg,jpg,gif - read image (& get file size)
    • if audio (check by mime type): only allow mpeg, mp3, m4a, mp4, wav, x-wav, ogg
    • if video (check by mime type): only allow mp4,webm, ogg
  • check if mime-type matches extension

Guida contributor