Server 2.10.2: warn when an uploaded save has no items.txt
Bought parts (oil filter, spark plugs, fan belt, battery ...) and whether they are installed are stored in items.txt. Without it they are missing on the car - e.g. the finished Satsuma of a downloaded save loses oil on the server (in singleplayer an old local items.txt hides the problem). The upload result now says so. 2 new tests (148 pass). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -537,8 +537,10 @@ async Task PanelTests()
|
||||
up.Headers.Add("X-MSCO-Panel", "1");
|
||||
up.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/zip");
|
||||
var upRes = await owner.SendAsync(up);
|
||||
string upText = await upRes.Content.ReadAsStringAsync();
|
||||
Check(upRes.IsSuccessStatusCode && File.ReadAllText(Path.Combine(dir, "save", "defaultES2File.txt")) == "ZIPPED SAVE",
|
||||
"A save game ZIP can be uploaded: " + await upRes.Content.ReadAsStringAsync());
|
||||
"A save game ZIP can be uploaded: " + upText);
|
||||
Check(upText.Contains("items.txt is missing"), "Uploading a save without items.txt warns (bought parts like the oil filter would be missing)");
|
||||
Check(!File.Exists(Path.Combine(dir, "..", "evil.txt")) && !File.Exists(Path.Combine(dir, "evil.txt")), "Paths inside the ZIP are never used");
|
||||
Check(File.ReadAllText(Path.Combine(dir, "save_original", "defaultES2File.txt")) == "ZIPPED SAVE", "The uploaded save is the new reset point");
|
||||
// RAR (mit WinRAR gepackt, "solid", Unterordner, zusätzliche fremde Datei)
|
||||
@@ -550,6 +552,7 @@ async Task PanelTests()
|
||||
Check(rarRes.IsSuccessStatusCode && File.ReadAllText(Path.Combine(dir, "save", "defaultES2File.txt")) == "RAR SAVE"
|
||||
&& File.ReadAllText(Path.Combine(dir, "save", "items.txt")) == "rar items" && !File.Exists(Path.Combine(dir, "save", "readme.txt")),
|
||||
"A RAR archive can be uploaded (only the save files are taken): " + await rarRes.Content.ReadAsStringAsync());
|
||||
Check(!(await rarRes.Content.ReadAsStringAsync()).Contains("items.txt is missing"), "No items.txt warning when the save has items.txt");
|
||||
var junk = new HttpRequestMessage(HttpMethod.Post, "api/save/upload") { Content = new ByteArrayContent(System.Text.Encoding.UTF8.GetBytes("this is no archive")) };
|
||||
junk.Headers.Add("X-MSCO-Panel", "1");
|
||||
var junkRes = await owner.SendAsync(junk);
|
||||
|
||||
Reference in New Issue
Block a user