Home > database >  Magento 2 Directory '' is not under storage root path
Magento 2 Directory '' is not under storage root path

Time:11-24

App: Magento 2.3.7-p2

When executing \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\Upload::execute

$this->getStorage()->getSession()->getCurrentPath()= '' although in the previous call

\Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\Contents::execute

the current Path was successfully saved via $this->_initAction()->_saveSessionCurrentPath().

I do not understand why $this->getStorage()->getSession()->getCurrentPath() = ''.

CodePudding user response:

Run Below Command and check it

php bin/magento config:set system/security/max_session_size_admin 0

php bin/magento c:f

If your Folder is not showing than create below code:

For security purposes, Magento provides Media Gallery access to contents in specific folders. The configuration path system/media_storage_configuration/media_storage/allowed_resource/media_gallery_image_folders in config.xml is used to define “Media Gallery Allowed” folders

By default, Magento allows Media Gallery access to the following two directories under /pub/media:

  • catalog/category

  • wysiwyg

app/code/VendoreName/ModuleName/etc

config.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
        <system>
            <media_storage_configuration>
                <allowed_resources>
                    <catalog_images_folder>catalog</catalog_images_folder> <!-- Show Catalog Folder -->
                    <media_gallery_image_folders>
                        <category_image_folder>catalog/category</category_image_folder> <!--  Show Sub Catalog Folder -->
                        <my_image_folder>custom_folder_name</my_image_folder>
                        <my_catalog_image_folder>catalog/custom_folder_name</my_catalog_image_folder>
                    </media_gallery_image_folders>
                </allowed_resources>
            </media_storage_configuration>
        </system>
    </default>
</config>

I Hope This Helps You.

CodePudding user response:

Try your luck after increasing the maximum session size limit for admin. Store configuration is at path

Stores > Settings > Configuration > Advanced > System > Security > Max Session Size in Admin

I debugged the same problem and ended up finding out that there are some important values to get in to admin session, which unfortunately isn't happening due to this size limit.

  • Related