-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check that filenames are ASCII instead of silent corruption (see #6)
- Loading branch information
Showing
5 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Codec.Archive.Tar.PackAscii | ||
( packAscii | ||
) where | ||
|
||
import qualified Data.ByteString.Char8 as BS.Char8 | ||
import Data.Char | ||
import GHC.Stack | ||
|
||
-- | We should really migrate to 'OsPath' from 'filepath', | ||
-- but for now let's not corrupt data silently. | ||
packAscii :: HasCallStack => FilePath -> BS.Char8.ByteString | ||
packAscii xs | ||
| all isAscii xs = BS.Char8.pack xs | ||
| otherwise = error $ "packAscii: only ASCII filenames are supported, but got " ++ xs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ See also http://pvp.haskell.org/faq | |
* Speed up `fromTarPathToPosixPath` | ||
* Set permissions on extracted files | ||
* Handle > 8 GB files | ||
* Prohibit non-ASCII file names instead of silent corruption | ||
|
||
0.5.1.1 Herbert Valerio Riedel <[email protected]> August 2019 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters