strip newlines in manifest display fields

This commit is contained in:
Jesse Plamondon-Willard 2018-11-23 17:33:30 -05:00
parent d1fb273d20
commit 43f11cfe51
No known key found for this signature in database
GPG Key ID: 7D7C8097B62033CE
2 changed files with 18 additions and 0 deletions

View File

@ -3,6 +3,9 @@
* For players:
* Fixed cryptic error when running the installer from inside a zip file on Windows.
* For modders:
* Fixed newlines in most manifest fields not being ignored.
* For the web UI:
* Added stats to compatibility list.
* Fixed compatibility list showing beta header when there's no beta in progress.

View File

@ -90,6 +90,14 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
}
}
// normalise display fields
if (manifest != null)
{
manifest.Name = this.StripNewlines(manifest.Name);
manifest.Description = this.StripNewlines(manifest.Description);
manifest.Author = this.StripNewlines(manifest.Author);
}
return new ModFolder(root, manifestFile.Directory, manifest, manifestError);
}
@ -164,5 +172,12 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
{
return !this.IgnoreFilesystemEntries.Contains(entry.Name);
}
/// <summary>Strip newlines from a string.</summary>
/// <param name="input">The input to strip.</param>
private string StripNewlines(string input)
{
return input?.Replace("\r", "").Replace("\n", "");
}
}
}