Jump to content

Install theme on prestashop 1.7.0.3 bug "Invalid file format."


owltheme

Recommended Posts

yea, looks like they made a change in the AdminThemesController.php

 

They changed this ...

        $finfo = new finfo(FILEINFO_MIME_TYPE);
        $ext = array_search(
            $finfo->file($_FILES['themearchive']['tmp_name']),
            array(
                'zip' => 'application/zip',
            ),
            true
        );
        if ($ext === false) {
            $this->errors[] = $this->trans('Invalid file format.', array(), 'Admin.Design.Notification');
            return false;
        }

To this...

        if ('application/zip' !== $_FILES['themearchive']['type']) {
            $this->errors[] = $this->trans('Invalid file format.', array(), 'Admin.Design.Notification');
            return false;
        }

They are probably trying to remove the dependency on FileInfo extension, and failed to test that the new code would actually work.  You could try to revert that code back to the 1.7.0.2 version, but ideally you should create a forge ticket so they are aware of the issue and can fix it in the next release
 

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

The below code work for me in prestashop 1.7.0.3

I havea changed in the AdminThemesController.php

They changed this ...

        $finfo = new finfo(FILEINFO_MIME_TYPE);
        $ext = array_search(
            $finfo->file($_FILES['themearchive']['tmp_name']),
            array(
                'zip' => 'application/zip',
            ),
            true
        );
        if ($ext === false) {
            $this->errors[] = $this->trans('Invalid file format.', array(), 'Admin.Design.Notification');
            return false;
        }

To this...

        if ('application/zip' !== $_FILES['themearchive']['type']) {
            $this->errors[] = $this->trans('Invalid file format.', array(), 'Admin.Design.Notification');
            return false;
        }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...