From dcf5e10e25993c7a30145c99e947e0d1ab4a2901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= <nils@piksel.se> Date: Wed, 30 Jun 2021 11:48:07 +0200 Subject: [PATCH] fix(tar): create translated files in temp --- src/ICSharpCode.SharpZipLib/Core/PathUtils.cs | 2 +- src/ICSharpCode.SharpZipLib/Tar/TarArchive.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ICSharpCode.SharpZipLib/Core/PathUtils.cs b/src/ICSharpCode.SharpZipLib/Core/PathUtils.cs index 77c4b07fc..b8d0dd409 100644 --- a/src/ICSharpCode.SharpZipLib/Core/PathUtils.cs +++ b/src/ICSharpCode.SharpZipLib/Core/PathUtils.cs @@ -36,7 +36,7 @@ public static string DropPathRoot(string path) /// </summary> /// <param name="original">If specified, used as the base file name for the temporary file</param> /// <returns>Returns a temporary file name</returns> - public static string GetTempFileName(string original) + public static string GetTempFileName(string original = null) { string fileName; var tempPath = Path.GetTempPath(); diff --git a/src/ICSharpCode.SharpZipLib/Tar/TarArchive.cs b/src/ICSharpCode.SharpZipLib/Tar/TarArchive.cs index 3ae5f7757..4b373fb64 100644 --- a/src/ICSharpCode.SharpZipLib/Tar/TarArchive.cs +++ b/src/ICSharpCode.SharpZipLib/Tar/TarArchive.cs @@ -824,7 +824,7 @@ private void WriteEntryCore(TarEntry sourceEntry, bool recurse) { if (!IsBinary(entryFilename)) { - tempFileName = Path.GetRandomFileName(); + tempFileName = PathUtils.GetTempFileName(); using (StreamReader inStream = File.OpenText(entryFilename)) {