fix(extraction): classify RAR directories without losing collision safety
Use WinRAR's directory-attribute listing as a counted type source so bare folder entries remain valid while file-directory aliases are still rejected. Emit only removed for successfully deleted JVM partial outputs so asynchronous consumers preserve the original archive error instead of reporting a stale missing file.
This commit is contained in:
@@ -375,12 +375,13 @@ public final class JBindExtractorMain {
|
||||
throw error;
|
||||
} finally {
|
||||
if (!extractionSuccess && output.exists()) {
|
||||
emitOutput(request.archiveFile, entryName, output, "partial", outputTarget.disposition);
|
||||
if (output.delete()) {
|
||||
emitOutput(request.archiveFile, entryName, output, "removed", outputTarget.disposition);
|
||||
} else {
|
||||
emitOutput(request.archiveFile, entryName, output, "partial", outputTarget.disposition);
|
||||
}
|
||||
}
|
||||
if (!extractionSuccess && output.exists() && output.delete()) {
|
||||
emitOutput(request.archiveFile, entryName, output, "removed", outputTarget.disposition);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
progress.emitDone();
|
||||
@@ -1294,14 +1295,19 @@ public final class JBindExtractorMain {
|
||||
closeCurrentStreamOnly();
|
||||
if (!currentSuccess[0] && currentOutput[0] != null && currentOutput[0].exists()) {
|
||||
int pos = currentPos[0];
|
||||
if (pos >= 0) {
|
||||
if (currentOutput[0].delete()) {
|
||||
if (pos >= 0) {
|
||||
emitOutput(archiveFile, entryNames.get(pos), currentOutput[0], "removed", dispositions.get(pos));
|
||||
}
|
||||
} else if (pos >= 0) {
|
||||
emitOutput(archiveFile, entryNames.get(pos), currentOutput[0], "partial", dispositions.get(pos));
|
||||
}
|
||||
if (currentOutput[0].delete() && pos >= 0) {
|
||||
emitOutput(archiveFile, entryNames.get(pos), currentOutput[0], "removed", dispositions.get(pos));
|
||||
}
|
||||
}
|
||||
}
|
||||
currentOutput[0] = null;
|
||||
currentPos[0] = -1;
|
||||
currentSuccess[0] = false;
|
||||
currentRemaining[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class WrongPasswordException extends Exception {
|
||||
|
||||
Reference in New Issue
Block a user