CRLF inside of cfsavecontent fails in 5.4.3.2

With the recent security release we updated to 5.4.3.2; however this has caused an issue with exporting a file based on a query.

Previously, we used “Chr(13) & Chr(10)” to insert a new line (carriage return and line feed) within a tag. However, this no longer seems to work correctly post-upgrade. It no longer inserts subsequent rows on new lines, but rather it just continues on the same row. Has there been a change in this functionality in the recent upgrades?

Saw this: NewLine() :: Lucee Documentation, but that doesn’t seem to help.

Noticed this: solved https://luceeserver.atlassian.net/browse/LDEV-1957 · lucee/Lucee@366c49c · GitHub but that seems to be v6 only.

Any suggestions on how to return to previous behavior?

Don’t forget to tell us about your stack!

OS: Windows 2019
Java Version: 11.0.11 (AdoptOpenJDK) 64bit
Tomcat Version: Apache Tomcat/9.0.40
Lucee Version: 5.4.3.2

Can you give us a working code example where that is happening?

image

<cfset delimitChar = '#Chr(9)#">
<cfset endChar = #chr(13)# & #chr(10)#>
<cfsavecontent
variable="fileContent"> <cfoutput>DATE#delimitChar#ORDER
###delimitChar#NAME#delimitChar#BILL
COMPANY#endChar#</cfoutput></cfsavecontent> <cfsavecontent variable="newRow"> <cfoutput>#trim(now
())##delimitChar#1234#delimitChar#John Doe#delimitChar#COMPANY#endChar#</cfoutput></cfsavecon tent>
<cfsavecontent
variable="fileContent"> <cfoutput>#fileContent##newRow#</cfou tput></cfsavecontent>
<cfheader name="Content-Disposition" value="filename=order- export-#Date Format(Now(), 'yyyymmdd')##Time Format(Now
(),'HHmmss')#.xls">
<cfcontent type="application/msexcel">
<cfoutput>#fileContent#</cfoutput> <cfabort>

Roberto, there’s an error in your code that wouldn’t let it run in TryCF so I simplified it a bit to get around the error. Included that code below.

But… the problem still exists. There should be a new line created after the word Company and there’s not… the actual data just continues on the same line. That’s the issue.

If you ran this on ver 5.2.x.x it would work and include that line.

<cfset delimitChar = '#Chr(9)#'>
<cfset endChar = #chr(13)# & #chr(10)#>
<cfsavecontent
variable="fileContent"> <cfoutput>DATE#delimitChar#ORDER
###delimitChar#NAME#delimitChar#BILL
COMPANY#endChar#</cfoutput></cfsavecontent> <cfsavecontent variable="newRow"> <cfoutput>#trim(now
())##delimitChar#1234#delimitChar#John Doe#delimitChar#COMPANY#endChar#</cfoutput></cfsavecontent>
<cfsavecontent variable="fileContent"> <cfoutput>#fileContent##newRow#</cfoutput></cfsavecontent>
<cfheader name="Content-Disposition" value="filename=order-export.xls">
<cfcontent type="application/msexcel">
<cfoutput>#fileContent#</cfoutput>
<cfabort>

As far as I know there have been no intentional changes made, but 5.2 was released a long time ago

What would be great is if you could try a few stable releases to try and narrow down when the change occurred

Zach, we’ve coded around this issue, and since few others are complaining about it, I’m going to stop worrying about it.

I just can’t justify the time, loading versions until I find where it breaks, but completely understand your request.

This is also occurring in 5.3.10.97

@ObiWebKenobi
How did you work around it, please?

In our case we were exporting a .csv file. We switched to CFspreadsheet which worked great.

Thanks.
We too are creating a CSV - but have found that we cannot use CFSpreadhseet, because it doesn’t maintain our cell boundaries correctly and so were forced to do it by hand.

Any chance you recall the version of Lucee that is did work for?
then I will step forward through the versions - until I find the one where it stopped working.

Pretty sure the version that worked for us was 5.2.9.031 the bug might have gotten introduced much later than that though.

1 Like