Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/ICSharpCode.SharpZipLib/Tar/TarEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,14 @@ public void GetFileTarHeader(TarHeader header, string file)
string name = file;

// 23-Jan-2004 GnuTar allows device names in path where the name is not local to the current directory
// 04-Apr-2019 Removed this block, as it creates different behavior based the location of the executing
// assembly.
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of this block is to do exactly that. While I do agree that this may not belong here, just removing it will just break code relying on this behaviour.

if (name.IndexOf(Directory.GetCurrentDirectory(), StringComparison.Ordinal) == 0)
{
name = name.Substring(Directory.GetCurrentDirectory().Length);
}
*/

/*
if (Path.DirectorySeparatorChar == '\\')
Expand All @@ -404,14 +408,6 @@ public void GetFileTarHeader(TarHeader header, string file)

name = name.Replace(Path.DirectorySeparatorChar, '/');

// No absolute pathnames
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a viable solution.

// Windows (and Posix?) paths can start with UNC style "\\NetworkDrive\",
// so we loop on starting /'s.
while (name.StartsWith("/", StringComparison.Ordinal))
{
name = name.Substring(1);
}

header.LinkName = String.Empty;
header.Name = name;

Expand Down