File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/main/java/org/codehaus/plexus/archiver/zip Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ private void createArchiveMain()
342342 /**
343343 * Gets the {@code UnicodeExtraFieldPolicy} to apply.
344344 *
345- * @return {@link ZipArchiveOutputStream.UnicodeExtraFieldPolicy.NOT_ENCODEABLE }, if the effective encoding is
345+ * @return {@link ZipArchiveOutputStream.UnicodeExtraFieldPolicy.NEVER }, if the effective encoding is
346346 * UTF-8; {@link ZipArchiveOutputStream.UnicodeExtraFieldPolicy.ALWAYS}, if the effective encoding is not
347347 * UTF-8.
348348 *
@@ -372,8 +372,12 @@ private ZipArchiveOutputStream.UnicodeExtraFieldPolicy getUnicodeExtraFieldPolic
372372 }
373373 }
374374
375+ // Using ZipArchiveOutputStream.UnicodeExtraFieldPolicy.NOT_ENCODEABLE as a fallback makes no sense here.
376+ // If the encoding is UTF-8 and a name is not encodeable using UTF-8, the Info-ZIP Unicode Path extra field
377+ // is not encodeable as well. If the effective encoding is not UTF-8, we always add the extra field. If it is
378+ // UTF-8, we never add the extra field.
375379 return utf8
376- ? ZipArchiveOutputStream .UnicodeExtraFieldPolicy .NOT_ENCODEABLE
380+ ? ZipArchiveOutputStream .UnicodeExtraFieldPolicy .NEVER
377381 : ZipArchiveOutputStream .UnicodeExtraFieldPolicy .ALWAYS ;
378382
379383 }
You can’t perform that action at this time.
0 commit comments