1

In Drupal 8 I have fields of type File and Image, inside Content types and forms. These fields stores files inside the "public" folder.

When I upload files with a name containing spaces, for example a file named "example with spaces.pdf", the file is correctly uploaded but once uploaded it is no more available.

The image below is just after uploaded an image containing spaces in the filename. Note that all seems correct:

enter image description here

When I save and publish the content I get this:

enter image description here

And returning back in the edit panel the thumbnail is no more available:

enter image description here

Same problem above trying to upload files inside a field of type File.

The file's url becomes something like this:

localhost:8888/sites/default/files/2016-05/example%20with%20spaces.jpg

But I'm redirected to the home page trying to open such url. Maybe there is a bug in Drupal when translates the url encoded filename in the real one.

If the filename has no spaces, or if the file is uploaded inside the "private" folder, there are no problems.

Any idea about how to solve this problem?


EDIT

I can reproduce the error with following steps:

  1. Download Drupal

    $ drush pm-download drupal --drupal-project-rename=drupal
    
  2. Install Drupal

    $ cd drupal
    $ drush site-install standard \
    --db-url='mysql://[db-user]:[db-pass]@localhost:[db-port]/drupal' \
    --account-name=admin --account-pass=password \
    --site-name="Drupal" \
    [email protected]
    
  3. Start Drupal

    $ drush runserver
    
  4. Create a new 'Article' and upload an image with spaces.

Maybe is there something wrong in steps above? Or a bug in the drush's built-in server?

3
  • Unless you have contrib/custom modules installed which might be affecting things, this smells very much like a core bug, and will need to be reported to the issue queue on Drupal.org (we can't help with bugs or their workarounds here). It would be worth disabling all contrib/custom modules to check if the problem is still there - that way you'll know if there's any point waiting for an answer here or whether a bug report needs to be opened
    – Clive
    May 5, 2016 at 8:10
  • @Clive I tried on a fresh installation of Drupal 8.1 (no modules installed), and still I have the problem. So is it a bug in the core? Is there not a quick solution?
    – Andrea
    May 5, 2016 at 8:39
  • 1
    If it happens on a fresh install then yeah, almost certainly a bug. There wouldn't be a solution on this site I'm afraid, we deliberately stay away from working around bugs so all that jazz can happen in the issue queue where the right people see it. The other (unlikely) possibility is that your server config is somehow causing the problem, but it's difficult to be able to check that without full access to the server
    – Clive
    May 5, 2016 at 8:42

2 Answers 2

1

Just I checked on different types of image files. So it could not reproduce your error. In my opinion, if your problem is in the server settings or the settings of the Drupal 8. Because viewing the forums, the Internet, communicate with colleagues at work, such a mistake, I have not met anybody.

2
  • Thank you @Wise Ltd. Take a look to my last edit in the answer. Could it be a bug in the drush's built-in server?
    – Andrea
    May 5, 2016 at 9:31
  • Maybe. If there is an opportunity to check up on what a test server or hosting checked.
    – Wise Ltd.
    May 5, 2016 at 9:39
1

I found out that it was a problem with drush runserver, maybe a bug. Currently I'm using Drush 9.0-dev. Probably will be fixed soon.

Using apache all it works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.