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
Next Next commit
Apply suggestions by Jozkee
  • Loading branch information
carlossanlop authored and github-actions committed Aug 31, 2022
commit 74747ea6cf2ece14020a9b83302f6cbed3d9d507
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public int Gid
/// A timestamps that represents the last time the contents of the file represented by this entry were modified.
/// </summary>
/// <remarks>In Unix platforms, this timestamp is commonly known as <c>mtime</c>.</remarks>
/// <exception cref="ArgumentOutOfRangeException">Cannot set a value larger than <see cref="DateTimeOffset.UnixEpoch"/>.</exception>
/// <exception cref="ArgumentOutOfRangeException">The specified value is larger than <see cref="DateTimeOffset.UnixEpoch"/>.</exception>
public DateTimeOffset ModificationTime
{
get => _header._mTime;
Expand All @@ -115,8 +115,8 @@ public DateTimeOffset ModificationTime
/// <summary>
/// When the <see cref="EntryType"/> indicates a <see cref="TarEntryType.SymbolicLink"/> or a <see cref="TarEntryType.HardLink"/>, this property returns the link target path of such link.
/// </summary>
/// <exception cref="InvalidOperationException">Cannot set the link name if the entry type is not <see cref="TarEntryType.HardLink"/> or <see cref="TarEntryType.SymbolicLink"/>.</exception>
/// <exception cref="ArgumentNullException">Cannot set a <see langword="null"/> link name.</exception>
/// <exception cref="InvalidOperationException">The entry type is not <see cref="TarEntryType.HardLink"/> or <see cref="TarEntryType.SymbolicLink"/>.</exception>
/// <exception cref="ArgumentNullException">The specified value is <see langword="null"/>.</exception>
public string LinkName
{
get => _header._linkName ?? string.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public static class TarFile
/// <param name="sourceDirectoryName">The path of the directory to archive.</param>
/// <param name="destination">The destination stream the archive.</param>
/// <param name="includeBaseDirectory"><see langword="true"/> to include the base directory name as the first segment in all the names of the archive entries. <see langword="false"/> to exclude the base directory name from the archive entry names.</param>
/// <exception cref="ArgumentNullException"><paramref name="sourceDirectoryName"/> of <paramref name="destination"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException"><paramref name="sourceDirectoryName"/> or <paramref name="destination"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException"><para><paramref name="sourceDirectoryName"/> is empty.</para>
/// <para>-or-</para>
/// <para><paramref name="destination"/> is an unwritable stream.</para></exception>
/// <para><paramref name="destination"/> does not support writing.</para></exception>
/// <exception cref="DirectoryNotFoundException">The <paramref name="sourceDirectoryName"/> directory path was not found.</exception>
/// <exception cref="IOException">An I/O exception occurred.</exception>
public static void CreateFromDirectory(string sourceDirectoryName, Stream destination, bool includeBaseDirectory)
Expand Down Expand Up @@ -56,10 +56,11 @@ public static void CreateFromDirectory(string sourceDirectoryName, Stream destin
/// <param name="destination">The destination stream of the archive.</param>
/// <param name="includeBaseDirectory"><see langword="true"/> to include the base directory name as the first path segment in all the names of the archive entries. <see langword="false"/> to exclude the base directory name from the entry name paths.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A task that represents the asynchronous creation operation.</returns>\/// <exception cref="ArgumentNullException"><paramref name="sourceDirectoryName"/> of <paramref name="destination"/> is <see langword="null"/>.</exception>
/// <returns>A task that represents the asynchronous creation operation.</returns>
/// <exception cref="ArgumentNullException"><paramref name="sourceDirectoryName"/> or <paramref name="destination"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException"><para><paramref name="sourceDirectoryName"/> is empty.</para>
/// <para>-or-</para>
/// <para><paramref name="destination"/> is an unwritable stream.</para></exception>
/// <para><paramref name="destination"/> does not support writing.</para></exception>
/// <exception cref="DirectoryNotFoundException">The <paramref name="sourceDirectoryName"/> directory path was not found.</exception>
/// <exception cref="IOException">An I/O exception occurred.</exception>
public static Task CreateFromDirectoryAsync(string sourceDirectoryName, Stream destination, bool includeBaseDirectory, CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -203,7 +204,7 @@ public static void ExtractToDirectory(Stream source, string destinationDirectory
/// <para>-or-</para>
/// <para><paramref name="destinationDirectoryName"/> is empty.</para>
/// <para>-or-</para>
/// <para><paramref name="source"/> is an unreadable stream.</para></exception>
/// <para><paramref name="source"/> does not support reading.</para></exception>
/// <exception cref="IOException">An I/O exception occurred.</exception>
public static Task ExtractToDirectoryAsync(Stream source, string destinationDirectoryName, bool overwriteFiles, CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public sealed class TarReader : IDisposable, IAsyncDisposable
/// Initializes a <see cref="TarReader"/> instance that can read tar entries from the specified stream, and can optionally leave the stream open upon disposal of this instance.
/// </summary>
/// <param name="archiveStream">The stream to read from.</param>
/// <param name="leaveOpen"><see langword="false"/> to dispose the <paramref name="archiveStream"/> when this instance is disposed; <see langword="true"/> to leave the stream open.</param>
/// <exception cref="ArgumentException"><paramref name="archiveStream"/> is unreadable.</exception>
/// <param name="leaveOpen"><see langword="false"/> to dispose the <paramref name="archiveStream"/> when this instance is disposed, as well as all the non-null <see cref="TarEntry.DataStream"/> instances from the entries that were visited by this reader; <see langword="true"/> to leave all the streams open.</param>
/// <exception cref="ArgumentException"><paramref name="archiveStream"/> does not support reading.</exception>
/// <exception cref="ArgumentNullException"><paramref name="archiveStream"/> is <see langword="null"/>.</exception>
public TarReader(Stream archiveStream, bool leaveOpen = false)
{
Expand All @@ -48,7 +48,7 @@ public TarReader(Stream archiveStream, bool leaveOpen = false)
}

/// <summary>
/// Disposes the current <see cref="TarReader"/> instance, and disposes the streams of all the entries that were read from the archive.
/// Disposes the current <see cref="TarReader"/> instance, and disposes the non-null <see cref="TarEntry.DataStream"/> instances of all the entries that were read from the archive.
/// </summary>
/// <remarks>The <see cref="TarEntry.DataStream"/> property of any entry can be replaced with a new stream. If the user decides to replace it on a <see cref="TarEntry"/> instance that was obtained using a <see cref="TarReader"/>, the underlying stream gets disposed immediately, freeing the <see cref="TarReader"/> of origin from the responsibility of having to dispose it.</remarks>
public void Dispose()
Expand All @@ -68,7 +68,7 @@ public void Dispose()
}

/// <summary>
/// Asynchronously disposes the current <see cref="TarReader"/> instance, and disposes the streams of all the entries that were read from the archive.
/// Asynchronously disposes the current <see cref="TarReader"/> instance, and disposes the non-null <see cref="TarEntry.DataStream"/> instances of all the entries that were read from the archive.
/// </summary>
/// <remarks>The <see cref="TarEntry.DataStream"/> property of any entry can be replaced with a new stream. If the user decides to replace it on a <see cref="TarEntry"/> instance that was obtained using a <see cref="TarReader"/>, the underlying stream gets disposed immediately, freeing the <see cref="TarReader"/> of origin from the responsibility of having to dispose it.</remarks>
public async ValueTask DisposeAsync()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public sealed partial class TarWriter : IDisposable, IAsyncDisposable
/// <param name="archiveStream">The stream to write to.</param>
/// <remarks>When using this constructor, <see cref="TarEntryFormat.Pax"/> is used as the default format of the entries written to the archive using the <see cref="WriteEntry(string, string?)"/> method.</remarks>
/// <exception cref="ArgumentNullException"><paramref name="archiveStream"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException"><paramref name="archiveStream"/> is unwritable.</exception>
/// <exception cref="ArgumentException"><paramref name="archiveStream"/> does not support writing.</exception>
public TarWriter(Stream archiveStream)
: this(archiveStream, TarEntryFormat.Pax, leaveOpen: false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ public void TarReader_LeaveOpen_False_CopiedDataNotDisposed()
}
}
}
}
}