I have a custom content entity (service) with a 'file' field defined by:
$fields['file'] = BaseFieldDefinition::create('file')
->setLabel(t('File'))
->setSettings([
'file_extensions' => 'pdf',
'file_directory' => 'sel',
'description_field' => TRUE,
])
->setDisplayOptions('view', [
'type' => 'file',
])
->setDisplayOptions('form', [
'type' => 'file',
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
A classic CRUD form allows me to create a service:
Lets say I upload a file with spaces in its name. As you can see if I hover the file name in the form, the link appears to be http://jdp8:8888/sites/default/files/sel/name%20with%20spaces.pdf
with space
replaced by %20
and the link works:
So far, so good...
I have a View to display this content entity:
The 'file' field is rendered as a '•' with a link to the file that allows to open the content of the file (a .pdf file) in another window.
When the file name contains spaces, it is rendered as http://jdp8:8888/sites/default/files/sel/name%2520with%2520spaces.pdf
with %2520
instead of %20
.
And of course the links leads to a The requested page was not found
error.
I have recently updated Drupal to 8.9.13.
Before I was running Drupal 8.9.1 and I am pretty sure that it was working.
Any idea on what is going wrong? Is it Drupal? Is it Views?
As I suspect Views (everywhere else, it works), here is the way the file field is handled in the view: