summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Controllers/LogParserController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web/Controllers/LogParserController.cs')
-rw-r--r--src/SMAPI.Web/Controllers/LogParserController.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/SMAPI.Web/Controllers/LogParserController.cs b/src/SMAPI.Web/Controllers/LogParserController.cs
index db53d942..33af5a81 100644
--- a/src/SMAPI.Web/Controllers/LogParserController.cs
+++ b/src/SMAPI.Web/Controllers/LogParserController.cs
@@ -45,7 +45,7 @@ namespace StardewModdingAPI.Web.Controllers
[HttpGet]
[Route("log")]
[Route("log/{id}")]
- public async Task<ActionResult> Index(string id = null, LogViewFormat format = LogViewFormat.Default, bool renew = false)
+ public async Task<ActionResult> Index(string? id = null, LogViewFormat format = LogViewFormat.Default, bool renew = false)
{
// fresh page
if (string.IsNullOrWhiteSpace(id))
@@ -69,7 +69,7 @@ namespace StardewModdingAPI.Web.Controllers
case LogViewFormat.RawDownload:
{
- string content = file.Error ?? file.Content;
+ string content = file.Error ?? file.Content ?? string.Empty;
return this.File(Encoding.UTF8.GetBytes(content), "plain/text", $"SMAPI log ({id}).txt");
}
@@ -87,7 +87,7 @@ namespace StardewModdingAPI.Web.Controllers
public async Task<ActionResult> PostAsync()
{
// get raw log text
- string input = this.Request.Form["input"].FirstOrDefault();
+ string? input = this.Request.Form["input"].FirstOrDefault();
if (string.IsNullOrWhiteSpace(input))
return this.View("Index", this.GetModel(null, uploadError: "The log file seems to be empty."));
@@ -97,7 +97,7 @@ namespace StardewModdingAPI.Web.Controllers
return this.View("Index", this.GetModel(null, uploadError: uploadResult.UploadError));
// redirect to view
- return this.Redirect(this.Url.PlainAction("Index", "LogParser", new { id = uploadResult.ID }));
+ return this.Redirect(this.Url.PlainAction("Index", "LogParser", new { id = uploadResult.ID })!);
}
@@ -109,7 +109,7 @@ namespace StardewModdingAPI.Web.Controllers
/// <param name="expiry">When the uploaded file will no longer be available.</param>
/// <param name="uploadWarning">A non-blocking warning while uploading the log.</param>
/// <param name="uploadError">An error which occurred while uploading the log.</param>
- private LogParserModel GetModel(string pasteID, DateTime? expiry = null, string uploadWarning = null, string uploadError = null)
+ private LogParserModel GetModel(string? pasteID, DateTimeOffset? expiry = null, string? uploadWarning = null, string? uploadError = null)
{
Platform? platform = this.DetectClientPlatform();