Skip to content
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

8276123: ZipFile::getEntry will not return a file entry when there is a directory entry of the same name within a Zip File #6342

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1631,13 +1631,18 @@ private int getEntryPos(String name, boolean addSlash) {
// slash
int entryLen = entry.length();
int nameLen = name.length();
if ((entryLen == nameLen && entry.equals(name)) ||
(addSlash &&
nameLen + 1 == entryLen &&
entry.startsWith(name) &&
entry.charAt(entryLen - 1) == '/')) {
if (entryLen == nameLen && entry.equals(name)) {
// Found our match
return pos;
}
// If addSlash is true we'll now test for name+/ providing
if (addSlash && nameLen + 1 == entryLen
&& entry.startsWith(name) &&
entry.charAt(entryLen - 1) == '/') {
// Found the entry "name+/", now find the CEN entry pos
int exactPos = getEntryPos(name, false);
return exactPos == -1 ? pos : exactPos;
}
} catch (IllegalArgumentException iae) {
// Ignore
}