-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Closed
Copy link
Labels
area-System.IO.Compressionhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
If a ZipArchive instance is created with ZipArchiveMode.Update then disposed without being used to modify the archive, the underlying stream is still modified. If that underlying stream is a FileStream, this results in the associated file's modified timestamp being updated.
void Test() {
using var stream = new FileStream("Test.zip", FileMode.Open, FileAccess.ReadWrite);
using (var zip = new ZipArchive(stream, ZipArchiveMode.Update))
{
// do nothing
} // even though the archive was unchanged from the user's perspective, stream is still updated, which changes Test.zip's modified timestamp
}In contrast, FileStream does not exhibit this behavior. Simply opening a modifiable FileStream does not change the underlying file's modified timestamp.
Is how ZipArchive modifies its backing stream even when the archive is unmodified by the user a bug or a feature? :-)
What would be the chances of ZipArchive's manners being improved to avoid modifying its backing stream in this case?
Thanks!
-- dotnet version: 3.1.200
udlose
Metadata
Metadata
Assignees
Labels
area-System.IO.Compressionhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged