commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Wiedmann (JIRA)" <>
Subject [jira] [Created] (IO-567) FilenameUtils is unaware of NTFS alternate data streams
Date Tue, 30 Jan 2018 14:23:00 GMT
Jochen Wiedmann created IO-567:

             Summary: FilenameUtils is unaware of NTFS alternate data streams
                 Key: IO-567
             Project: Commons IO
          Issue Type: Bug
            Reporter: Jochen Wiedmann

Windows NTFS has a feature, called ADS (Alternate Data Streams). Basically, it works like
this: Traditionally, a file called "foo" consists of a byte stream, which can be read,if we
open the file "foo". Not so with NTFS. A file may have other byte streams, the so-called alternate
data streams. These are addressed by using file names like "foo:alternate_stream_name". (Colon
as a separator.)


While that is not a problem in itself, it may become difficult in connection with file name
extensions. As you know, these have a special meaning on Windows. A .exe file may be executed.
Thus, a .exe file with unknown contents would be dangerous. In the case of NTFS, this must
be rephrased: A .exe file with unknown contents in its default data stream would be dangerous.


Now consider the case of a name like "foo.exe:bar.txt". This would be the alternate data stream
named "bar.txt" in a file, named "foo.exe". If that name is passed to FilenameUtils.getExtension(String),
it would happily return ".txt", although the Windows Explorer, or whatever other tool would
show us "foo.exe".


Commons IO should implement special case handling for this in FilenameUtils.getExtension(String),
and FilenameUtils.indexOfExtension(String)




    a) Document the problem in Javadoc, and

    b) Throw an IllegalArgumentException, if the file name contains a ':'.


This message was sent by Atlassian JIRA

View raw message