Fix map installation.

This commit is contained in:
Paul Chote
2021-04-06 13:54:44 +01:00
committed by teinarss
parent f9294f0e9e
commit bb8a634ba8

View File

@@ -476,15 +476,13 @@ namespace OpenRA
innerData.Status = MapStatus.Downloading;
var installLocation = cache.MapLocations.FirstOrDefault(p => p.Value == MapClassification.User);
if (installLocation.Key == null || !(installLocation.Key is IReadWritePackage))
if (!(installLocation.Key is IReadWritePackage mapInstallPackage))
{
Log.Write("debug", "Map install directory not found");
innerData.Status = MapStatus.DownloadError;
return;
}
var mapInstallPackage = installLocation.Key as IReadWritePackage;
Task.Run(async () =>
{
// Request the filename from the server
@@ -508,8 +506,14 @@ namespace OpenRA
return;
}
response.Headers.TryGetValues("Content-Disposition", out var values);
var mapFilename = values.First().Replace("attachment; filename = ", "");
var mapFilename = response.Content.Headers.ContentDisposition?.FileName;
// Map not found
if (string.IsNullOrEmpty(mapFilename))
{
innerData.Status = MapStatus.DownloadError;
return;
}
var fileStream = new MemoryStream();