Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
44300eb
Throw ArgumentException on unsupported tar entry type
carlossanlop Aug 30, 2022
386ca70
Adjust tests
carlossanlop Aug 30, 2022
4c049be
Also change exception type for internal TarEntry conversion construct…
carlossanlop Aug 30, 2022
712acb5
LinkName setter null check.
carlossanlop Aug 31, 2022
785584d
Internal constructors SeekableSubReadStream and SubReadStream unseeka…
carlossanlop Aug 31, 2022
5931c6b
DataStream setter for regular file should throw ArgumentException if …
carlossanlop Aug 31, 2022
2848e80
TarFile CreateFromDirectory unwritable destination change exception t…
carlossanlop Aug 31, 2022
1647a89
Change to ArgumentException when ExtractToDirectory is an unreadable …
carlossanlop Aug 31, 2022
5216a08
Add some missing exception docs for TarEntry.
carlossanlop Aug 31, 2022
64efec2
Change TarReader constructor exception if unreadable stream. Close te…
carlossanlop Aug 31, 2022
3694af2
Change TarWriter exception for unwritable stream to ArgumentException…
carlossanlop Aug 31, 2022
bc608fc
Add missing documentation for exceptions in constructors.
carlossanlop Aug 31, 2022
b6d620c
Change wording of conversion constructors comment when passing a Pax …
carlossanlop Aug 31, 2022
9c4ccaa
Apply suggestions by Jozkee
carlossanlop Aug 31, 2022
13f52c0
Add exception to LinkName if the entry type is hard/symlink and the u…
carlossanlop Aug 31, 2022
e7d911d
Convert all FormatException to InvalidDataException
carlossanlop Aug 31, 2022
ed4ab9c
Address more suggestions
carlossanlop Aug 31, 2022
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
Prev Previous commit
Address more suggestions
  • Loading branch information
carlossanlop committed Aug 31, 2022
commit ed4ab9ce5532acba2b591d6eedaacfa64ec9c609
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal TarEntry(TarEntryType entryType, string entryName, TarEntryFormat forma

if (!isGea)
{
TarHelpers.ThrowIfEntryTypeNotSupported(entryType, format, nameof(entryType));
TarHelpers.ThrowIfEntryTypeNotSupported(entryType, format);
}

// Default values for fields shared by all supported formats
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ public static Task CreateFromDirectoryAsync(string sourceDirectoryName, string d
/// <exception cref="UnauthorizedAccessException">Operation not permitted due to insufficient permissions.</exception>
/// <exception cref="ArgumentException"><para>Extracting tar entry would have resulted in a file outside the specified destination directory.</para>
/// <para>-or-</para>
/// <para><paramref name="destinationDirectoryName"/> is empty.</para></exception>
/// <para><paramref name="destinationDirectoryName"/> is empty.</para>
/// <para>-or-</para>
/// <para><paramref name="source"/> does not support reading.</para></exception>
/// <exception cref="IOException">An I/O exception occurred.</exception>
public static void ExtractToDirectory(Stream source, string destinationDirectoryName, bool overwriteFiles)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Globalization;
using System.IO;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -291,7 +292,7 @@ internal static async ValueTask<int> SkipBlockAlignmentPaddingAsync(Stream archi
}

// Throws if the specified entry type is not supported for the specified format.
internal static void ThrowIfEntryTypeNotSupported(TarEntryType entryType, TarEntryFormat archiveFormat, string paramName)
internal static void ThrowIfEntryTypeNotSupported(TarEntryType entryType, TarEntryFormat archiveFormat, [CallerArgumentExpression("entryType")] string? paramName = null)
{
switch (archiveFormat)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class PaxTarEntry_Conversion_Tests : TarTestsConversionBase
public void Constructor_ConversionFromGnu_CharacterDevice() => TestConstructionConversion(TarEntryType.CharacterDevice, TarEntryFormat.Gnu, TarEntryFormat.Pax);

[Fact]
public void Constructor_ConstructorFromPaxGEA_ToAny_Throw()
public void Constructor_ConversionFromPaxGEA_ToAny_Throw()
{
Assert.Throws<ArgumentException>(() => new V7TarEntry(new PaxGlobalExtendedAttributesTarEntry(new Dictionary<string, string>())));
Assert.Throws<ArgumentException>(() => new UstarTarEntry(new PaxGlobalExtendedAttributesTarEntry(new Dictionary<string, string>())));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System.Xml.Linq;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using Xunit;
using System.Linq;
using Xunit;

namespace System.Formats.Tar.Tests
{
Expand Down