Open jswigart opened 1 year ago
Hello @jswigart, thanks for opening this issue.
Non-literally quoting myself from Slack:
The zip file is opened with
FileAccess.ReadWrite
andFileShare.Read
(the default): https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/IO/FileStream.cs,120 We should useFileAccess.Read
in the constructor call, asReadWrite
is not actualy needed.
There's no need for an option, as EmbedIO considers a Zip file an immutable file provider.
While we're on the subject, it wouldn't hurt to specify FileShare.Read
explicitly too.
This is the line to fix in version 3 (branch v3.x
).
This is the line to fix in version 4 (branch master
).
Any kind soul willing to submit a PR?
Describe the bug The built in WithZipFile extension method provides no mechanism for the user to open the zip file in read only mode, which is problematic if you have another instance of the map, or external tooling, also wanting to read the archive in read only mode.
To Reproduce Steps to reproduce the behavior:
Expected behavior Expect to be able to open a zip file in read only mode. If the ZipFileProvider doesn't support writing at all, then the WithZipFile should just hard code to read only, as there is no reason for a write lock to be held.
Additional context This was discussed a bit in slack for more information on October 24th, 2022