we use the TYPO3 Flow 2.3 integrated Resource object to upload any kind of files in our project. The definition in our File object is:
/**
* @var \TYPO3\Flow\Resource\Resource
* @ORM\ManyToOne
*/
protected $originalresource;
And the fluid call goes like:
<a class="filelink" data-icon="{file.filetype}" href="{f:uri.resource(resource: file.originalresource)}" target="_blank">{file.name}</a>
Everything in this constellation works fine until a user uploads a file without ending like hosts. The server says Not Found in the regular Apache error style. Are files without endings supported or not? Why does this happen?
The Setting is:
TYPO3:
Flow:
resource:
storages:
defaultPersistentResourcesStorage:
storage: 'TYPO3\Flow\Resource\Storage\WritableFileSystemStorage'
storageOptions:
path: '%FLOW_PATH_DATA%Persistent/Resources/'
targets:
localWebDirectoryPersistentResourcesTarget:
target: 'TYPO3\Flow\Resource\Target\FileSystemSymlinkTarget'
targetOptions:
path: '%FLOW_PATH_WEB%_Resources/Persistent/'
baseUri: '_Resources/Persistent/'
And the created symbolic link for the hosts file in _Resources/Persistent/ is named with the hash and then a dot without file ending pointing the the actual file. The actual file exists.
It's a bug and you can report it here: https://jira.neos.io/
In Flow 3.x it works fine, but there were major changes with resource management.
Adding one line to Web/.htaccess should solve the problem, but I can't tell it's best solution.
And answer why it happens - persistent resources are stored by default in
Data/Persistent/Resources/<hash>and in you have symlink there fromWeb/_Resources/Persistent/<hash>.extension. So standard symlink looks like that:If file has no extension there is just dot at the end
So in fact link returned by ResourceViewHelper (FileSystemPublishingTarget) is correct, but first rewrite rule above requires extension. Adding second one you catch files without extension and just add . at the end to match correct symlink with hash and dot at the end.