Skip to content

Commit 242cfe9

Browse files
Copilotslachiewicz
andcommitted
Fix: Make file writable before delete on Windows for read-only files
Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
1 parent 882221c commit 242cfe9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ protected void extractFile(
327327
// Delete existing file first to handle read-only files
328328
// This matches the behavior of tar and unzip
329329
if (targetFileName.exists()) {
330+
// Make file writable before deleting (required on Windows for read-only files)
331+
targetFileName.setWritable(true);
330332
targetFileName.delete();
331333
}
332334
Files.copy(compressedInputStream, targetFileName.toPath(), REPLACE_EXISTING);

0 commit comments

Comments
 (0)