Magento 2目录“”不在存储根路径下

yebdmbv4  于 2022-11-12  发布在  其他
关注(0)|答案(3)|浏览(150)

应用程序:Magento 2.3.7-p2
执行\Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\Upload::execute
$this->getStorage()->getSession()->getCurrentPath()= ''尽管在上一次调用中

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

通过$this->_initAction()->_saveSessionCurrentPath()成功保存了当前路径。
我不明白为什么是$this->getStorage()->getSession()->getCurrentPath() = ''

ilmyapht

ilmyapht1#

运行以下命令并选中它

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

php bin/magento c:f

如果您的文件夹未显示,则创建以下代码:

出于安全考虑,Magento允许媒体集访问特定文件夹中的内容。config.xml中的配置路径system/media_storage_configuration/media_storage/allowed_resource/media_gallery_image_folders用于定义“允许媒体集”文件夹
默认情况下,Magento允许媒体剪辑库访问/pub/media下的以下两个目录:

  • 目录/类别
  • 所见即所得
    应用程序/代码/供应商名称/模块名称/等
    配置文件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>

我希望这对你有帮助

vaqhlq81

vaqhlq812#

增加admin的最大会话大小限制后试试运气。存储配置位于路径
商店〉设置〉配置〉高级〉系统〉安全〉管理员中的最大会话大小
我调试了同样的问题,并最终发现有一些重要的值进入管理会话,不幸的是,这是没有发生,由于这个大小限制。

toe95027

toe950273#

对于临时修复,您可以返回true,它将解决您的所有问题。

public function validatePath($path, $directoryConfig = DirectoryList::MEDIA)
    {
        $directory = $this->filesystem->getDirectoryWrite($directoryConfig);
        $realPath = realpath($directory->getDriver()->getRealPathSafety($path));
        $root = rtrim($directory->getAbsolutePath(), DIRECTORY_SEPARATOR);

        return true;
    }

相关问题