tracker issue : CF-4198847

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: cfftp's existsfile treats populated directory as file

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff ()

Created: 06/10/2017

Components: Net Protocols, FTP

Versions: 2016,11.0

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2016.0.01.298513 / 303850

Priority/Frequency: Major / Some users will encounter

Locale/System: / Win 2012 Server x64

Vote Count: 0

cfftp's existsfile treats populated directory as file

Repro:

<cfscript>
  myServer = "localhost";
  myUsername = "mysitecomwww";
  myPassword = "password";
  myDir = "foo";
  
  if(directoryExists(expandPath(myDir))) {
	  directoryDelete(expandPath(myDir), true);
  }
  directoryCreate(expandPath(myDir));
  cfftp(action="existsfile", remoteFile=myDir, result="r", server=myServer, username=myUsername, password=myPassword);
  writeOutput(r.returnValue);//returns False (good - b/c myDir isn't a file) (note: Actually, existsfile should return YES/NO instead of True/False - will log another bug)
  directoryCreate(expandPath(myDir & '/bar'));
  cfftp(action="existsfile", remoteFile=myDir, result="r", server=myServer, username=myUsername, password=myPassword);
  writeOutput(r.returnValue);//returns True (bug - b/c myDir isn't a file)
  directoryDelete(expandPath(myDir & '/bar'));
  cfftp(action="existsfile", remoteFile=myDir, result="r", server=myServer, username=myUsername, password=myPassword);
  writeOutput(r.returnValue);//returns False (good - b/c myDir isn't a file)
  fileWrite(expandPath(myDir & '/foo.txt'), "foobar");
  cfftp(action="existsfile", remoteFile=myDir, result="r", server=myServer, username=myUsername, password=myPassword);
  writeOutput(r.returnValue);//returns True (bug - b/c myDir isn't a file)
  fileDelete(expandPath(myDir & '/foo.txt'));
  cfftp(action="existsfile", remoteFile=myDir, result="r", server=myServer, username=myUsername, password=myPassword);
  writeOutput(r.returnValue);//returns False (good - b/c myDir isn't a file)
</cfscript>

Actual result: "FalseTrueFalseTrueFalse"

Expected result: "NONONONONO"

Attachments:

Comments:

This bug is fixed for CF 2018. We had fixed it for CF 2016 as well, but because of backward compatibility issues, we have reverted the fix.  
30014 | December 06, 2018 07:14:01 AM GMT
Hi Hari, Thank you very much! -Aaron
Comment by Aaron Neff
30020 | December 07, 2018 06:13:38 AM GMT