[PR #409] [MERGED] Recognise empty tar archives. #1012

Open
opened 2026-01-29 22:18:36 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/409
Author: @Quogu
Created: 8/17/2018
Status: Merged
Merged: 9/25/2018
Merged by: @adamhathcock

Base: masterHead: RecogniseEmptyTarArchives


📝 Commits (1)

  • 83f6690 Recognise empty tar archives.

📊 Changes

3 files changed (+15 additions, -3 deletions)

View changed files

📝 src/SharpCompress/Archives/Tar/TarArchive.cs (+4 -3)
📝 tests/SharpCompress.Test/Tar/TarArchiveTests.cs (+11 -0)
tests/TestArchives/Archives/Tar.Empty.tar (+0 -0)

📄 Description

Currently, when ArchiveFactory.Open is called on an empty tar archive, it throws due to being unable to determine the stream type. This fix allows it to recognise empty tar files by checking for whether the filename is empty, the size is empty and the entry type is defined. Add a test to try opening an empty archive.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/409 **Author:** [@Quogu](https://github.com/Quogu) **Created:** 8/17/2018 **Status:** ✅ Merged **Merged:** 9/25/2018 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `RecogniseEmptyTarArchives` --- ### 📝 Commits (1) - [`83f6690`](https://github.com/adamhathcock/sharpcompress/commit/83f66905767ca50b82bd39efece602eb6d5e49cc) Recognise empty tar archives. ### 📊 Changes **3 files changed** (+15 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/Archives/Tar/TarArchive.cs` (+4 -3) 📝 `tests/SharpCompress.Test/Tar/TarArchiveTests.cs` (+11 -0) ➕ `tests/TestArchives/Archives/Tar.Empty.tar` (+0 -0) </details> ### 📄 Description Currently, when ArchiveFactory.Open is called on an empty tar archive, it throws due to being unable to determine the stream type. This fix allows it to recognise empty tar files by checking for whether the filename is empty, the size is empty and the entry type is defined. Add a test to try opening an empty archive. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:18:36 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1012