Cannot upload a file with spaces in the file name.
Example "some file.pdf"

Comments

goodDenis created an issue. See original summary.

gooddenis’s picture

Status: Active » Needs review
StatusFileSize
new768 bytes

The problem was on render a select list element. Before the first space drupal added " symbol.

It was 
<option value="sites/default/ftp_uploads/some" file.pdf>some file.pdf</option>
and now it is 
<option value="sites/default/ftp_uploads/some file.pdf">some file.pdf</option>
shadowwolf218’s picture

I was having the same issue.
The patch provided appears to have fixed it completely.
Thanks!

gnuget’s picture

I tried to replicate this problem without luck.

Can you please provide a list of steps to replicate the bug?

Thanks!

shadowwolf218’s picture

I can't speak to OP's exact issue, but I suspect it looked much like mine.

(Drupal 8.8.1, Filefield Sources 8.x.1.x-dev)
Of course, pre-steps would be "install module with composer" and "install module from "Extend" list in Drupal."

- configure form display to allow "attach" as an upload method
- in my case, I am using this with existing Media field: Audio so I'll use that as the example
- set upload directory path and confirm allowed filetypes: mp3 aac wav

- upload via FTP (Filezilla, in case it matters): Test File.mp3 and Test_File.mp3

- navigate to "Add Media Item" and select Audio

- "File attach" appears next to "Upload"
- select "File attach," dropdown menu appears
- both files appear in dropdown menu

- select Test File.mp3, click Attach
- error => <em class="placeholder">File </em> is not an allowed filetype (mp3 aac wav). Illegal choice detected, please contact site administrator.
(I don't remember this as exactly as I'd like, but note the filename has been changed.)

- select Test_File.mp3, click Attach
- attach succeeds, file "upload" succeeds, file appears in media list

I thought the issue was happening during filename munging or transliteration, but that clearly wasn't the case.
Hope this helps.

gnuget’s picture

StatusFileSize
new2.28 KB
new3.03 KB

Thanks for your help @shadowwolf218 !

I was able to reproduce the problem thanks to you and I wrote a test so we can avoid any regression in the future.

Patch and tests attached.

  • gnuget committed 27f3bac on 8.x-1.x
    Issue #3104846 by gnuget, goodDenis, shadowwolf218: Cannot upload a file...
gnuget’s picture

Status: Needs review » Fixed
gnuget’s picture

Assigned: gooddenis » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.