Skip to content

Commit

Permalink
Null-check central header use in resource importing
Browse files Browse the repository at this point in the history
  • Loading branch information
Col-E committed Sep 21, 2023
1 parent 1488fba commit 0d1f64d
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,15 @@ private WorkspaceFileResource handleZip(WorkspaceResourceBuilder builder, ZipFil
}

// Record common entry attributes
CentralDirectoryFileHeader centralHeader = header.getLinkedDirectoryFileHeader();
ZipCompressionProperty.set(info, header.getCompressionMethod());
if (centralHeader.getFileCommentLength() > 0)
ZipCommentProperty.set(info, centralHeader.getFileCommentAsString());
ExtraFieldTime.TimeWrapper extraTimes = ExtraFieldTime.read(header);
if (extraTimes == null)
extraTimes = ExtraFieldTime.read(centralHeader);
CentralDirectoryFileHeader centralHeader = header.getLinkedDirectoryFileHeader();
if (centralHeader != null) {
if (centralHeader.getFileCommentLength() > 0)
ZipCommentProperty.set(info, centralHeader.getFileCommentAsString());
if (extraTimes == null)
extraTimes = ExtraFieldTime.read(centralHeader);
}
if (extraTimes != null) {
ZipCreationTimeProperty.set(info, extraTimes.getCreationMs());
ZipModificationTimeProperty.set(info, extraTimes.getModifyMs());
Expand Down

0 comments on commit 0d1f64d

Please sign in to comment.