[ 
https://issues.apache.org/jira/browse/CAMEL-24415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on CAMEL-24415 started by Andrea Cosentino.
------------------------------------------------
> camel-file - normalizePathToProtocol turns a backslash in a legal POSIX file 
> name into a path separator
> -------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24415
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24415
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-file
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>            Priority: Major
>             Fix For: 4.23.0
>
>
> GenericFile.normalizePathToProtocol() rewrites both separators 
> unconditionally:
>     path = path.replace('/', getFileSeparator());
>     path = path.replace('\\', getFileSeparator());
> and is applied in setFileName() and setRelativeFilePath(), and when building 
> the CamelFilePath header.
> On POSIX a backslash is a legal character in a file name, so a 
> single-component file name that contains backslashes is rewritten into a 
> multi-component relative path. Downstream strategies that resolve the file 
> name against the endpoint directory (delete, move, done-file/marker handling) 
> then operate on a different path than the one that was actually read.
> Proposal: only translate the separator that is not legal on the current 
> platform (FileUtil.normalizePath() already does exactly this - on POSIX it 
> maps '\\' to '/' only when running on Windows), or keep the consumed file 
> name as an opaque single component. Needs a regression test on POSIX using a 
> file whose name legitimately contains backslashes.
> Before changing behaviour, confirm on a POSIX box which of the 
> delete/move/marker strategies actually resolve out of the starting directory, 
> so the fix targets the right layer.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to