1.2k questions
1.4k answers
361 comments
339 users
There are two workarounds for this situation. The first is to replace the comma (or other special character) with a wildcard asterisk, which will allow the standard call to work. The second is to use an Apache Camel parameter called include() to specify the filename.
To use the wildcard replacement method, you would use code similar to this:
// Start with the filename in a variable var fileName = 'test,comma.txt'; // Replace all instances of a comma with an asterisk var wildcardFileName = StringUtils.replace(fileName, ',', '*'); // Make the SFTP call to retrieve the file var file = qie.readSFTPFile(sftpHost, sftpPort, wildcardFileName, deleteFiles, null, true, true, params, userName, password, 60000);
// Start with the filename in a variable var fileName = 'test,comma.txt';
// Replace all instances of a comma with an asterisk var wildcardFileName = StringUtils.replace(fileName, ',', '*');
// Make the SFTP call to retrieve the file var file = qie.readSFTPFile(sftpHost, sftpPort, wildcardFileName, deleteFiles, null, true, true, params, userName, password, 60000);
The second method, using the Apache Camel include() filter can be done this way. This uses the wildcard asterisk in the standard file path field, which causes QIE to start with a list of all the files at that location. The include() filter in the parameters section limits what QIE actually operates on to just the one file specified
// Start with the filename in a variable var fileName = 'test,comma.txt'); // Make the SFTP call, using the filename variable in a Camel include() parameter var file = qie.readSFTPFile(sftpHost, sftpPort, '*', deleteFiles, null, true, true, 'include(RAW("' + fileName + '")', userName, password, 60000);
// Start with the filename in a variable var fileName = 'test,comma.txt');
// Make the SFTP call, using the filename variable in a Camel include() parameter var file = qie.readSFTPFile(sftpHost, sftpPort, '*', deleteFiles, null, true, true, 'include(RAW("' + fileName + '")', userName, password, 60000);