Patch UnRAR: don't replace symlinks with directories

UnRAR logic replaces directory symlinks found within archive file entry
file paths with actual directories by deleting them after they're
extracted.

Unfortunately, this logic extends to deleting existing directories if you
set the `DestName` instead of the `DestPath` in this API:

  rc = RARProcessFile(hArchive, RAR_EXTRACT, NULL, destFilePath);

In the future UnRAR may change to disable the `LinksToDirs()` feature
if using the `DestName` parameter. In the meantime, this commit
completely disables it for our use case.
This commit is contained in:
Micah Snyder 2023-08-23 10:06:59 -07:00 committed by Micah Snyder
parent 9ab25fe05a
commit 71a54bd7b2

View file

@ -642,10 +642,6 @@ bool CmdExtract::ExtractCurrentFile(Archive &Arc,size_t HeaderSize,bool &Repeat)
wcsncpyz(DestFileName,Cmd->DllDestName,ASIZE(DestFileName));
#endif
if (ExtrFile && Command!='P' && !Cmd->Test && !Cmd->AbsoluteLinks &&
ConvertSymlinkPaths)
ExtrFile=LinksToDirs(DestFileName,Cmd->ExtrPath,LastCheckedSymlink);
File CurFile;
bool LinkEntry=Arc.FileHead.RedirType!=FSREDIR_NONE;