siddiqueirshad opened a new pull request, #922:
URL: https://github.com/apache/commons-io/pull/922

   ## Summary
   
   This PR updates `FileUtils.deleteQuietly(File)` so that it does not clean 
the target directory contents when the input file is a link-like directory (a 
symbolic link or Windows junction).
   
   Both `deleteDirectory(File)` and `deleteDirectoryOnExit(File)` check 
`!isLinkLikeDirectory(directory)` before invoking `cleanDirectory(directory)`. 
Previously, `deleteQuietly(File)` only checked `file.isDirectory()` before 
calling `cleanDirectory(file)`, which could delete target files when `file` was 
a link-like directory pointing to an existing directory.
   
   Checking `!isLinkLikeDirectory(file)` ensures safe, consistent deletion 
behavior across all `FileUtils` directory deletion methods.
   
   ## Changes
   - Updated `FileUtils.deleteQuietly(File)` to check `file.isDirectory() && 
!isLinkLikeDirectory(file)`.
   - Added unit test in 
`FileUtilsCleanSymlinksTest#testDeleteQuietlySymlinkDirDoesNotCleanTarget` 
verifying that deleting a symbolic link directory via `deleteQuietly` removes 
the link entry without deleting files inside the target directory.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to