Fix import multiple file types via drag potentially reaching the wrong importer

This commit is contained in:
Dean Herbert 2021-04-13 14:03:42 +09:00
parent 84e1ff79a0
commit 4852630c93
1 changed files with 7 additions and 4 deletions

View File

@ -433,12 +433,15 @@ public async Task Import(params string[] paths)
if (paths.Length == 0)
return;
var extension = Path.GetExtension(paths.First())?.ToLowerInvariant();
var filesPerExtension = paths.GroupBy(p => Path.GetExtension(p).ToLowerInvariant());
foreach (var importer in fileImporters)
foreach (var groups in filesPerExtension)
{
if (importer.HandledExtensions.Contains(extension))
await importer.Import(paths).ConfigureAwait(false);
foreach (var importer in fileImporters)
{
if (importer.HandledExtensions.Contains(groups.Key))
await importer.Import(groups.ToArray()).ConfigureAwait(false);
}
}
}