Check for trailing slash

This commit is contained in:
jvyden 2021-10-18 10:18:39 -04:00
commit a081d9b384
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
2 changed files with 5 additions and 0 deletions

View file

@ -14,6 +14,10 @@ namespace UnionPatcher {
} }
public static byte[] PatchData(byte[] data, string serverUrl) { public static byte[] PatchData(byte[] data, string serverUrl) {
if(serverUrl.EndsWith('/')) {
throw new ArgumentException("URL must not contain a trailing slash!");
}
string dataAsString = Encoding.ASCII.GetString(data); string dataAsString = Encoding.ASCII.GetString(data);
using MemoryStream ms = new(data); using MemoryStream ms = new(data);

View file

@ -23,6 +23,7 @@ namespace UnionPatcher {
} }
Patcher.PatchFile(args[0], args[1], args[2]); Patcher.PatchFile(args[0], args[1], args[2]);
Console.WriteLine($"Successfully patched Server URL to {args[1]}.");
} }
public static void PrintHelp() { public static void PrintHelp() {