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
17fdb6e
Throw ArgumentException on unsupported tar entry type
carlossanlop Aug 30, 2022
151797a
Adjust tests
carlossanlop Aug 30, 2022
6b42246
Also change exception type for internal TarEntry conversion construct…
carlossanlop Aug 30, 2022
7b8a909
LinkName setter null check.
carlossanlop Aug 31, 2022
61010d8
Internal constructors SeekableSubReadStream and SubReadStream unseeka…
carlossanlop Aug 31, 2022
f51806e
DataStream setter for regular file should throw ArgumentException if …
carlossanlop Aug 31, 2022
0f9d96c
TarFile CreateFromDirectory unwritable destination change exception t…
carlossanlop Aug 31, 2022
5faad2c
Change to ArgumentException when ExtractToDirectory is an unreadable …
carlossanlop Aug 31, 2022
6094b2f
Add some missing exception docs for TarEntry.
carlossanlop Aug 31, 2022
2775c07
Change TarReader constructor exception if unreadable stream. Close te…
carlossanlop Aug 31, 2022
b116660
Change TarWriter exception for unwritable stream to ArgumentException…
carlossanlop Aug 31, 2022
18292b7
Add missing documentation for exceptions in constructors.
carlossanlop Aug 31, 2022
2f615e9
Change wording of conversion constructors comment when passing a Pax …
carlossanlop Aug 31, 2022
74747ea
Apply suggestions by Jozkee
carlossanlop Aug 31, 2022
3927c72
Add exception to LinkName if the entry type is hard/symlink and the u…
carlossanlop Aug 31, 2022
dd15f10
Convert all FormatException to InvalidDataException
carlossanlop Aug 31, 2022
eb4aebf
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 authored and github-actions committed Aug 31, 2022
commit eb4aebf5b7e8f18c21708c98904ccb0bc932c4da
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