summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-23 17:33:30 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-23 17:33:30 -0500
commit43f11cfe51fdbb6c8fdee657ddf82d740ff6d738 (patch)
tree1cbb94d0099b2b94bd82d07b24ef65ab3c2a93fb
parentd1fb273d20bd658ff4a28b149ff132e65f122255 (diff)
downloadSMAPI-43f11cfe51fdbb6c8fdee657ddf82d740ff6d738.tar.gz
SMAPI-43f11cfe51fdbb6c8fdee657ddf82d740ff6d738.tar.bz2
SMAPI-43f11cfe51fdbb6c8fdee657ddf82d740ff6d738.zip
strip newlines in manifest display fields
-rw-r--r--docs/release-notes.md3
-rw-r--r--src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs15
2 files changed, 18 insertions, 0 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index dab514d5..df8f6676 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -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.
diff --git a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs
index 106c294f..61d0d6f2 100644
--- a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs
+++ b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs
@@ -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", "");
+ }
}
}