Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: unlink(/data/web/magento2/magento/pub/media/): Is a directory in /data/web/magento2/magento/vendor/agencednd/module-pimgento/Product/Helper/Media.php on line 251 #194

Open
JensBourgeois opened this issue Jun 26, 2018 · 5 comments

Comments

@JensBourgeois
Copy link

JensBourgeois commented Jun 26, 2018

We are using Magento v2.2.3

This warning is causing the import to fail.
Problem seems to be the following line in data/web/magento2/magento/vendor/agencednd/module-pimgento/Product/Model/Factory/Import/Media.php on line 410.

$imagePath = $this->image->getNewFile();

According to Magento the getNewFile() function is deprecated, but after some debugging it also seems this function is obsolete. So the variable $imagePath always returns NULL and breaks the code.

@batmike
Copy link

batmike commented Jul 12, 2018

I'm having this same issue. I did find that there's another issue raised at #181 that is the same. He presented a quick fix that I'm going to test out but any official feedback on this would be great. Thanks!

Duplicate of #181

@akosglue
Copy link

akosglue commented Aug 1, 2018

Hi,
are there any updates on this?
or is this repository completely forgotten?

@pablollorens
Copy link
Contributor

What about this problem? Someone can create a pull request with that fix?

@akosglue
Copy link

This repo seems to be dead to me. There are no updates, PR merge's whatsoever ...
Even if we got a PR for this .. Would it be ever merged?
Regarding this problem: it seems to be difficult to reproduce, in my environment it happens sometimes, sometimes not ..
Have you found any solution to this?

@NicoSiebler
Copy link

NicoSiebler commented Feb 13, 2019

Not a PR (also, the repo is officially not supported anymore it seems), but this plugin code helped so the problem would not rise again if anyone is in need:

    public function aroundDeleteMediaFile(\Pimgento\Product\Helper\Media $subject, callable $proceed, $filePath): void
    {
        if (!$filePath) {
            return;
        }
        $absolutePath = rtrim($this->directoryList->getPath('media'), '/') . '/' . ltrim($filePath, '/');
        // Change: Do not remove file if it's a directory
        if (file_exists($absolutePath) && !is_dir($absolutePath)) {
            unlink($absolutePath);
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants