[
https://issues.apache.org/jira/browse/COMPRESS-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920549#action_12920549
]
Helmut Minst commented on COMPRESS-120:
---------------------------------------
if the data to extract is confidential, it might be forbidden to change the
filenames by default.
it would be nice to provide a method just like
ArchiveInputStream#replaceInvalidCharacters(Character replacement)
to switch the behaviour on and off
in TarArchiveInputStream#getNextTarEntry() just react on the String replacement.
String tmpNameString = currEntry.getName();
for (char forbidden : forbiddenChars) {
tmpNameString = tmpNameString.replace(forbidden, '_');
}
currEntry.setName(tmpNameString);
forbiddenChars may be different on different OS, so there must be a decision
where
the application runs on
analog to this, every nextEntry in other streams such as zip, jar... must
reacted.
the best way might be to implement this replacement in the parent class
@Sebb: "However, a Windows-specific filename "cleaning" method would
potentially be useful.
The code could potentially also be useful as part of Commons IO?"
yes, if there would be an easy to use method (callable in a static way), the
consumer may react on the filename or not.
> forbidden chars on windows
> --------------------------
>
> Key: COMPRESS-120
> URL: https://issues.apache.org/jira/browse/COMPRESS-120
> Project: Commons Compress
> Issue Type: Improvement
> Components: Archivers
> Affects Versions: 1.0
> Environment: WindowsXP32bit
> Reporter: Helmut Minst
> Priority: Minor
>
> while uncompressing a tar archive, which includes files and directories
> containing special characters like
> private char[] forbiddenCharsWindows = new char[] { ':', '*', '?', '"', '<',
> '>', '|' }; the name of the tarEntry is corrupt
> and to create the directory or file is not possible. Exceptions occurs while
> creating them.
> it would be better to replace them with '_' instead to respond invalid
> entrynames.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.