1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 20:32:55 +08:00
osu-lazer/osu.Game/IO
Bartłomiej Dach 83e47b3c4c
Fix exports containing zero byte files after import from specific ZIP archives
Closes https://github.com/ppy/osu/issues/27540.

As it turns out, some ZIP archivers (like 7zip) will decide to add fake
entries for directories, and some (like windows zipfolders) won't.
The "directory" entries aren't really properly supported using any
actual data or attributes, they're detected by sharpcompress basically
by heuristics:

    ab5535eba3/src/SharpCompress/Common/Zip/Headers/ZipFileEntry.cs (L19-L31)

When importing into realm we have thus far presumed that these directory
entries will not be a thing. Having them be a thing breaks multiple
things, like:

- When importing from ZIPs with separate directory entries, a separate
  `RealmFile` is created for a directory entry even though it doesn't
  represent a real file
- As a result, when re-exporting a model with files imported from such
  an archive, a zero-byte file would be created because to the database
  it looks like it was originally a zero-byte file.

If you want to have fun, google "zip empty directories". You'll see
a whole gamut of languages, libraries, and developers stepping on this
rake. Yet another episode of underspecced mistakes from decades ago
that were somebody's "good idea" but continue to wreak havoc forevermore
because now there are two competing conventions you can't just pick one.
2024-03-12 09:06:24 +01:00
..
Archives Fix exports containing zero byte files after import from specific ZIP archives 2024-03-12 09:06:24 +01:00
FileAbstraction Automated pass 2023-06-24 01:00:03 +09:00
Legacy Automated pass 2023-06-24 01:00:03 +09:00
Serialization Automated pass 2023-06-24 01:00:03 +09:00
FileInfo.cs Fix various other inspections 2023-10-17 17:48:51 +09:00
HardLinkHelper.cs Fix compile error (reserved name) 2024-02-02 21:28:51 +09:00
IFileInfo.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
IStorageResourceProvider.cs Update R# + fix inspections 2024-02-02 21:00:28 +09:00
LineBufferedReader.cs Fix crash on mobile releases when attempting to read any file 2022-07-09 06:01:22 +09:00
MigratableStorage.cs Add retry loop to avoid log export failing occasionally on windows 2024-01-25 13:53:36 +09:00
OsuStorage.cs Manual fixes to reduce warnings to zero 2023-06-24 01:52:53 +09:00
StableStorage.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
WrappedStorage.cs Use ArgumentException.ThrowIfNullOrEmpty throw helper 2024-03-05 10:20:57 +01:00