catalyst / moodle-fileconverter_librelambda

A Libre Office document converter for Moodle leveraging AWS Lambda
https://moodle.org/plugins/fileconverter_librelambda
Other
23 stars 18 forks source link

Conversion type extension issue #31

Closed cybernotic closed 8 months ago

cybernotic commented 4 years ago

Hi Matt, I have just come across potential issues involving extension type names. If a file has a uppercase extension (which sometimes occur with image files) this will fail as an unrecognised format because the list of supported import file formats are in lowercase.

I tested this by changing a file extension (xxx.png) to uppercase and then back to lowercase. So, would it be worth while to implement a strtolower() somewhere to capture the filename extension before it's checked against the supported list?

What are your thoughts on this?

Regards David

aspark21 commented 3 years ago

Quick update on this we looked at getting that fixed in core but apparently it's up to each plugin to address (https://tracker.moodle.org/browse/MDL-69616)

I think it'll also explains #41 as a lot of phones save image filetypes in capitals - that's how we came across it

juancartagena commented 1 year ago

This can be fixed here https://github.com/catalyst/moodle-fileconverter_librelambda/blob/master/classes/converter.php#L424 including the strtolower function:

    public static function supports($from, $to) {
        // This is not a one-liner because of php 5.6.
        $imports = self::$imports;
        $exports = self::$exports;
        return isset($imports[\core_text::strtolower($from)]) && isset($exports[$to]);
    }
tuanngocnguyen commented 8 months ago

Hi all,

I am closing this issue as it is fixed on: https://github.com/catalyst/moodle-fileconverter_librelambda/pull/72