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());