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
Next Next commit
Also change exception type for internal TarEntry conversion construct…
…or called by all other public conversion constructors. Add missing test gap.
  • Loading branch information
carlossanlop committed Aug 30, 2022
commit 4c049bec4b2180ddf09742786a0ff8631d9dd4dc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal TarEntry(TarEntry other, TarEntryFormat format)
{
if (other is PaxGlobalExtendedAttributesTarEntry)
{
throw new InvalidOperationException(SR.TarCannotConvertPaxGlobalExtendedAttributesEntry);
throw new ArgumentException(SR.TarCannotConvertPaxGlobalExtendedAttributesEntry, nameof(other));
}

TarEntryType compatibleEntryType = TarHelpers.GetCorrectTypeFlagForFormat(format, other.EntryType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ public class PaxTarEntry_Conversion_Tests : TarTestsConversionBase
[Fact]
public void Constructor_ConversionFromGnu_CharacterDevice() => TestConstructionConversion(TarEntryType.CharacterDevice, TarEntryFormat.Gnu, TarEntryFormat.Pax);

[Fact]
public void Constructor_ConstructorFromPaxGEA_ToAny_Throw()
{
Assert.Throws<ArgumentException>(() => new V7TarEntry(new PaxGlobalExtendedAttributesTarEntry(new Dictionary<string, string>())));
Assert.Throws<ArgumentException>(() => new UstarTarEntry(new PaxGlobalExtendedAttributesTarEntry(new Dictionary<string, string>())));
Assert.Throws<ArgumentException>(() => new PaxTarEntry(new PaxGlobalExtendedAttributesTarEntry(new Dictionary<string, string>())));
Assert.Throws<ArgumentException>(() => new GnuTarEntry(new PaxGlobalExtendedAttributesTarEntry(new Dictionary<string, string>())));
}

[Theory]
[InlineData(TarEntryFormat.V7)]
[InlineData(TarEntryFormat.Ustar)]
Expand Down