onedrop/shortresourceuri

Neos 包,用于缩短已发布资源的 URI

1.1.0 2023-07-13 13:22 UTC

This package is auto-updated.

Last update: 2024-09-13 15:53:50 UTC


README

此 Neos 包更改了持久资源存储的默认行为。

它将使用短 URI(如 /_media/alicecards.jpg)发布资源,而不是常规的 /_Resources/Persistent/0d5f77e755f664b393b62ca51a056c06f05e83c6/alicecards.jpg

如果您添加以下配置,它将覆盖 persistent 集合的默认发布目标

Neos:
  Flow:
    resource:
      targets:
        localWebDirectoryShortUriPersistentResourcesTarget:
          target: 'Onedrop\ShortResourceUri\ResourceManagement\Target\FileSystemShortSymlinkTarget'
          targetOptions:
            baseUri: '_media/'
            path: '%FLOW_PATH_WEB%_media/'
      collections:
        persistent:
          target: 'localWebDirectoryShortUriPersistentResourcesTarget'

从 v1.2.0 版本开始,这必须手动添加,不再默认包含。这样就可以在例如仅在生产环境中启用。

防止重复

由于我们没有在发布的文件名目标中具有唯一部分,我们必须防止这种情况发生。因此,如果您尝试添加重复的文件名,将抛出 DuplicateFilenameException

这可能在将来得到改进。