Issue with double spaces in filenames

89 views
Skip to first unread message

Jace Coleman

unread,
Nov 5, 2015, 5:11:12 PM11/5/15
to Lucee
I believe that I may have found a bug when it comes to double spaces in fileNames.  I'm on a windows server using Lucee 4.5.1.024.  When i use cffile to upload a document that contains a double space in the filename the file is written to the server with the double space in tact.  However file.serverfile appears to have trimmed the filename and outputs a single space which is resulting in a file not found error.  I wrote the following test code and confirmed the same issue in cfDirectory:

My filename is: 'test  file.pdf'

<cfdirectory directory="/secure/test/doubleSpace/" name="getFiles">
<cfdump var="#getFiles#">

Which outputs:
Query
Execution Time: 0.436 ms 
Record Count: 2 
Cached: No 
Lazy: No 
 namesizetypedateLastModifiedattributesmodedirectory
1index.cfm117File{ts '2015-11-05 21:59:28'}C:\inetpub\wwwroot\application\secure\test\doubleSpace
2test file.pdf83699File{ts '2015-11-05 21:57:30'}C:\inetpub\wwwroot\application\secure\test\doubleSpace

Note the double space in my fileName and the single space in getFiles.name
Any suggestions to work around this?  I have also confirmed the same issue exists in the latest version of Railo.

Thanks!
Jace

Nando Breiter

unread,
Nov 5, 2015, 6:20:12 PM11/5/15
to lu...@googlegroups.com
Ok, but how is Lucee finding "test  file.pdf" to output it in that dump? Where's the file not found error? To me, <cfdirectory> seems to have found the file.

How do you know there is a single space in the getFiles.name result? (Perhaps you could test the length of the file name using len() and see if it is shorter than expected.)





Aria Media Sagl
Via Rompada 40
6987 Caslano
Switzerland

+41 (0)91 600 9601
+41 (0)76 303 4477 cell
skype: ariamedia

--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/7051eb77-6f73-45a3-9cd4-38ad3be4dfa3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jace Coleman

unread,
Nov 6, 2015, 10:27:04 AM11/6/15
to Lucee
Len() outputs 14 just as one would expect with the double space, even though the dump only shows 13 characters and one space.   I need to be able to retrieve an accurate file name via cffile in order to provide a link to the file that was uploaded by a user.  

Nando Breiter

unread,
Nov 6, 2015, 11:10:36 AM11/6/15
to lu...@googlegroups.com
Unless you can demonstrate otherwise, I'm under the impression that the file name is correct, but is simply being rendered in the browser as having only one space. See the following:

https://stackoverflow.com/questions/433493/why-do-multiple-spaces-in-an-html-file-show-up-as-single-spaces-in-the-browser



Aria Media Sagl
Via Rompada 40
6987 Caslano
Switzerland

+41 (0)91 600 9601
+41 (0)76 303 4477 cell
skype: ariamedia

Greg Wacker

unread,
Dec 21, 2015, 5:02:52 PM12/21/15
to Lucee
We ran into the same issue. Lucee preserves multiple spaces in the filename when saving the actual file but in the filename return variables it combines multiple spaces into one. I'm going to submit a bug in their issue tracker if I don't already see one.

Nando,
  • you can view source on his included dump table html to see that there is truly once space and not html combining them.
  • cfdirectory can "find" it because it isn't looking for a particular file, it's looking for a folder and looping through all files in the folder and returning the results ... incorrectly for the name attribute since it's combining spaces
  • his len() example is obviously before html has any part in this

Jace Coleman

unread,
Dec 21, 2015, 5:32:06 PM12/21/15
to Lucee
I was actually able to resolve this and at least in my case Nando was correct.  If I recall correctly my problem was that I was uploading the file asynchronsly and then using JS to update a form field containing the file name then submitting the form. 

Paul Klinkenberg

unread,
Dec 23, 2015, 6:52:20 AM12/23/15
to lu...@googlegroups.com
And you are not using the "suppress whitespace" option in the admin?

Kind regards,

Paul Klinkenberg

------------


--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages