This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new e4e0e03813 Text File input, prefix filename only works if file exists,
fixes #6664 (#6667)
e4e0e03813 is described below
commit e4e0e038133c45951f6a4809797c5517d31a011e
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Thu Feb 26 16:21:33 2026 +0100
Text File input, prefix filename only works if file exists, fixes #6664
(#6667)
---
.../fileinput/text/TextFileInputMeta.java | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git
a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java
b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java
index 660305bdc4..0d79aba728 100644
---
a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java
+++
b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java
@@ -639,16 +639,30 @@ public class TextFileInputMeta
type = IValueMeta.TYPE_STRING;
}
- String[] filePathList =
- FileInputList.createFilePathList(
+ FileInputList fileInputList =
+ FileInputList.createFileList(
variables,
inputFiles.fileName,
inputFiles.fileMask,
inputFiles.excludeFileMask,
inputFiles.fileRequired,
inputFiles.includeSubFolderBoolean());
-
- String fileNameToPrepend = filePathList.length > 0 ? filePathList[0] :
null;
+ String fileNameToPrepend = null;
+ if (fileInputList.nrOfFiles() > 0) {
+ fileNameToPrepend = fileInputList.getFile(0).getName().getURI();
+ } else if (!fileInputList.getNonExistentFiles().isEmpty()) {
+ fileNameToPrepend =
fileInputList.getNonExistentFiles().get(0).getName().getURI();
+ }
+ // When file list is empty (e.g. not required and missing), use
fictional path for prepend
+ if (content.prependFileName
+ && fileNameToPrepend == null
+ && inputFiles.fileName != null
+ && inputFiles.fileName.length > 0) {
+ String firstPath = variables.resolve(inputFiles.fileName[0]);
+ if (!Utils.isEmpty(firstPath)) {
+ fileNameToPrepend = firstPath;
+ }
+ }
try {
String fieldname =