Skip to content

Commit

Permalink
for force-cp decode only part of the path inside archive
Browse files Browse the repository at this point in the history
  • Loading branch information
rupor-github committed Mar 18, 2020
1 parent 1e02a75 commit fa446d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ endif()

# Project version number
set(PRJ_VERSION_MAJOR 1)
set(PRJ_VERSION_MINOR 43)
set(PRJ_VERSION_MINOR 44)

if (EXISTS "${PROJECT_SOURCE_DIR}/.git" AND IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/cmake/githash.sh ${GIT_EXECUTABLE}
Expand Down
10 changes: 5 additions & 5 deletions commands/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,17 @@ func processArchive(path, pathIn, pathOut string, format processor.OutputFmt, no
zap.Error(err))
} else {
defer r.Close()
path := filepath.Join(pathOut, f.FileHeader.Name)
apath := f.FileHeader.Name
if cpage != nil && f.FileHeader.NonUTF8 {
// forcing zip file name encoding
if n, err := cpage.NewDecoder().String(path); err == nil {
path = n
if n, err := cpage.NewDecoder().String(apath); err == nil {
apath = n
} else {
n, _ = ianaindex.IANA.Name(cpage)
env.Log.Warn("Unable to convert archive name from specified encoding", zap.String("charset", n), zap.String("path", path), zap.Error(err))
env.Log.Warn("Unable to convert archive name from specified encoding", zap.String("charset", n), zap.String("path", apath), zap.Error(err))
}
}
if err := processBook(r, enc, path, dst, nodirs, stk, overwrite, format, env); err != nil {
if err := processBook(r, enc, filepath.Join(pathOut, apath), dst, nodirs, stk, overwrite, format, env); err != nil {
env.Log.Error("Unable to process file in archive",
zap.String("archive", archive),
zap.String("file", f.FileHeader.Name),
Expand Down

0 comments on commit fa446d2

Please sign in to comment.