Bug in clearTemporaryImages() - Forum | JoomShaper
Staff replied EasyStore

Bug in clearTemporaryImages()

Asked by bergwerk 1 year ago Last activity 1 year ago

Hi there,

i was investigating an error on the order detail page (already reported here: https://www.joomshaper.com/forum/question/35478) and found a completly different bug instead.

In the file admin/src/Traits/Media.php the function clearTemporaryImages() always returns an error because an else is missing

    public function clearTemporaryImages()
    {
            $requestMethod = $this->getInputMethod();
        $this->checkNotAllowedMethods(['POST', 'PUT', 'PATCH', 'DELETE'], $requestMethod);

        $clientId   = $this->getInput('client_id', '', 'STRING');
        $imageModel = new MediaModel();
        $response   = new \stdClass();

        if ($imageModel->clearTemporaryImages($clientId)) {
            $this->removeTemporaryFiles($clientId);
            $response->status = true;
        }

        $response->status = false;
        $this->sendResponse($response);

    }

should be:

    public function clearTemporaryImages()
    {
        $requestMethod = $this->getInputMethod();
        $this->checkNotAllowedMethods(['POST', 'PUT', 'PATCH', 'DELETE'], $requestMethod);

        $clientId   = $this->getInput('client_id', '', 'STRING');
        $imageModel = new MediaModel();
        $response   = new \stdClass();

        if ($imageModel->clearTemporaryImages($clientId)) {
            $this->removeTemporaryFiles($clientId);
            $response->status = true;
        } else {
            $response->status = false;
        }

        $this->sendResponse($response);
    }

Not sure what it does anyway, but every bug less in easy store is a good thing i guess? :-)

3 replies

Ofi Khan Staff

Hello bergwerk

Thanks for your feedback. I have forwarded your issue to the developer team. They will check it soon. However, can you share more details of the issue?

clearTemporaryImages() always returns an error

Where do you see the error? On the frontend or admin panel? Please share a screenshot of your issue to understand it better. Take a screenshot and share via any platform. For example: Lightshot or Imgur

Best regards

bergwerk Asked this

Hi Ofi,

ah sorry, i forgot to mention. It's not visible per se, but it is a hidden ajax request when opening the order detail page: https://imgur.com/Ydk3zX1

Ofi Khan Staff

I have got feedback from the developer team. It will be fixed in the next version. Thanks for finding out this.

Please accept the answer that helped you. Finding the solution for the other users with the same issue will be easier. There is a button to accept answers after each comment.

Log in to reply.