From 89494ee4b55c4e6dbc8bb9e238729bc05c6d5e67 Mon Sep 17 00:00:00 2001 From: chaorongzhi Date: Tue, 3 Sep 2024 13:49:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(ftpfile):=20=E6=90=BA=E5=B8=A6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E6=97=B6=E5=8E=BB=E6=8E=89=E5=A4=9A=E4=BD=99=E5=89=8D?= =?UTF-8?q?=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/source/reader/AbstractReadStrategy.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java b/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java index 7ce50d2854b..f127e613998 100644 --- a/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java +++ b/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java @@ -227,7 +227,17 @@ protected SeaTunnelRow dataCarryFilename(SeaTunnelRow seaTunnelRow, String path) } else { System.arraycopy(fields, 1, newFields, 1, fields.length - 1); } - newFields[0] = path; + String oriPath = pluginConfig.getString(BaseSourceConfigOptions.FILE_PATH.key()); + String[] split = path.split(oriPath.replace("\\", "/")); + String filePath = oriPath; + if (split.length > 1) { + if (oriPath.endsWith("/")) { + filePath = oriPath + split[1]; + } else { + filePath = oriPath + "/" + split[1]; + } + } + newFields[0] = filePath; SeaTunnelRow newSeaTunnelRow = new SeaTunnelRow(newFields); newSeaTunnelRow.setRowKind(seaTunnelRow.getRowKind()); newSeaTunnelRow.setTableId(seaTunnelRow.getTableId());