Skip to content

No need to fallback to unicode path extra field policy NOT_ENCODEABLE. #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private void createArchiveMain()
/**
* Gets the {@code UnicodeExtraFieldPolicy} to apply.
*
* @return {@link ZipArchiveOutputStream.UnicodeExtraFieldPolicy.NOT_ENCODEABLE}, if the effective encoding is
* @return {@link ZipArchiveOutputStream.UnicodeExtraFieldPolicy.NEVER}, if the effective encoding is
* UTF-8; {@link ZipArchiveOutputStream.UnicodeExtraFieldPolicy.ALWAYS}, if the effective encoding is not
* UTF-8.
*
Expand Down Expand Up @@ -372,8 +372,12 @@ private ZipArchiveOutputStream.UnicodeExtraFieldPolicy getUnicodeExtraFieldPolic
}
}

// Using ZipArchiveOutputStream.UnicodeExtraFieldPolicy.NOT_ENCODEABLE as a fallback makes no sense here.
// If the encoding is UTF-8 and a name is not encodeable using UTF-8, the Info-ZIP Unicode Path extra field
// is not encodeable as well. If the effective encoding is not UTF-8, we always add the extra field. If it is
// UTF-8, we never add the extra field.
return utf8
? ZipArchiveOutputStream.UnicodeExtraFieldPolicy.NOT_ENCODEABLE
? ZipArchiveOutputStream.UnicodeExtraFieldPolicy.NEVER
: ZipArchiveOutputStream.UnicodeExtraFieldPolicy.ALWAYS;

}
Expand Down