From f565cc861d9b176d29312016ed820ce6f1b3e297 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 19 Mar 2018 20:41:12 +0900 Subject: [PATCH] Hard bail on attempting to import an invalid archive format --- osu.Game/Database/ArchiveModelManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index a65593ff82..4c60db3a23 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -13,6 +13,7 @@ using osu.Game.IO.Archives; using osu.Game.IPC; using osu.Game.Overlays.Notifications; +using SharpCompress.Common; using FileInfo = osu.Game.IO.FileInfo; namespace osu.Game.Database @@ -331,7 +332,9 @@ private ArchiveReader getReaderFrom(string path) { if (ZipFile.IsZipFile(path)) return new ZipArchiveReader(Files.Storage.GetStream(path), Path.GetFileName(path)); - return new LegacyFilesystemReader(path); + if (Directory.Exists(path)) + return new LegacyFilesystemReader(path); + throw new InvalidFormatException($"{path} is not a valid archive"); } } }