Fix map installation.
This commit is contained in:
@@ -476,15 +476,13 @@ namespace OpenRA
|
|||||||
|
|
||||||
innerData.Status = MapStatus.Downloading;
|
innerData.Status = MapStatus.Downloading;
|
||||||
var installLocation = cache.MapLocations.FirstOrDefault(p => p.Value == MapClassification.User);
|
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");
|
Log.Write("debug", "Map install directory not found");
|
||||||
innerData.Status = MapStatus.DownloadError;
|
innerData.Status = MapStatus.DownloadError;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapInstallPackage = installLocation.Key as IReadWritePackage;
|
|
||||||
|
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
// Request the filename from the server
|
// Request the filename from the server
|
||||||
@@ -508,8 +506,14 @@ namespace OpenRA
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
response.Headers.TryGetValues("Content-Disposition", out var values);
|
var mapFilename = response.Content.Headers.ContentDisposition?.FileName;
|
||||||
var mapFilename = values.First().Replace("attachment; filename = ", "");
|
|
||||||
|
// Map not found
|
||||||
|
if (string.IsNullOrEmpty(mapFilename))
|
||||||
|
{
|
||||||
|
innerData.Status = MapStatus.DownloadError;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var fileStream = new MemoryStream();
|
var fileStream = new MemoryStream();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user