Closed andmor- closed 5 years ago
Put quick improvement in place. Default is now .mp4 unless an acceptable media type is encountered.
I needed to add (72afa3a) mimetypes for zip
files (application/zip
).
zip
mimetype is supported by some tools: WebSty and Topic. See: https://github.com/clarin-eric/LRSwitchboard-rest/blob/master/Registry.js#L1821
This highlights a design problem: to add a new tool (or a new mimetype to an existing tool), both have to be updated: https://github.com/clarin-eric/LRSwitchboard/blob/master/app/back-end/util.js and https://github.com/clarin-eric/LRSwitchboard-rest/blob/master/Registry.js
This is less than ideal: defeats the ability to add tools without rebuilding the code and makes the code more error prone, increasing its complexity.
Currently it is also not clear why we need function fileExtensionChooser (mimetype)
for uploaded files.
For now I commit this as a quick fix but we must fix the design problem.
Solved in the new Switchboard where the tool registry informs the frontend what media types are accepted.
Current the mimetypes supported for upload are hardcoded. See: https://github.com/clarin-eric/LRSwitchboard/blob/master/app/back-end/util.js#L66
This raises two problems:
.txt
and will be uploaded astext/plain
. This makes it difficult to use Nextcloud's upload filter based on mimetype. The mimetype we want to allow is preciselytext/plain
, but if a video file is uploaded, it will be uploaded as a.txt
and thus defeating the NC filter.A quick improvement would be to remove or change the
default
case on L84 to something we want and can block e.g..mp4
In the long term we want to have this list extracted to a separate text file which is read either at runtime or during startup. The generation of the list must be based on the list of mimetypes supported by the tools.