diff --git a/CHANGE-LOG.md b/CHANGE-LOG.md
index bf49379..cced4d7 100644
--- a/CHANGE-LOG.md
+++ b/CHANGE-LOG.md
@@ -1,5 +1,8 @@
# Change Log for Raygun.Aspire.Hosting.Raygun
+### v2.0.2
+- Fixed a bug where exceptions with long message names could not be saved.
+
### v2.0.1
- Fixed a bug where new exception reports would be displayed as occurring 12 hours ago if they occurred after midday UTC (because of formatting dates with 12 hour time instead of 24 hour time - losing the precision for subsequent time logic).
diff --git a/src/Raygun.Aspire.Hosting.Raygun/Raygun.Aspire.Hosting.Raygun.csproj b/src/Raygun.Aspire.Hosting.Raygun/Raygun.Aspire.Hosting.Raygun.csproj
index 3d74e98..9388abb 100644
--- a/src/Raygun.Aspire.Hosting.Raygun/Raygun.Aspire.Hosting.Raygun.csproj
+++ b/src/Raygun.Aspire.Hosting.Raygun/Raygun.Aspire.Hosting.Raygun.csproj
@@ -22,7 +22,7 @@
git
https://raygun.com/platform/crash-reporting
false
- 2.0.1
+ 2.0.2
diff --git a/src/Raygun.Aspire.Hosting.Raygun/RaygunAspireWebAppBuilderExtensions.cs b/src/Raygun.Aspire.Hosting.Raygun/RaygunAspireWebAppBuilderExtensions.cs
index 310c1b1..81ffefb 100644
--- a/src/Raygun.Aspire.Hosting.Raygun/RaygunAspireWebAppBuilderExtensions.cs
+++ b/src/Raygun.Aspire.Hosting.Raygun/RaygunAspireWebAppBuilderExtensions.cs
@@ -8,7 +8,7 @@ public static IResourceBuilder AddRaygun(this IDistr
{
var raygun = new RaygunAspireWebAppResource(name);
return builder.AddResource(raygun)
- .WithAnnotation(new ContainerImageAnnotation { Image = "raygunowner/raygun-aspire-portal", Tag = "2.0.1" })
+ .WithAnnotation(new ContainerImageAnnotation { Image = "raygunowner/raygun-aspire-portal", Tag = "2.0.2" })
.WithAnnotation(new EndpointAnnotation(ProtocolType.Tcp, uriScheme: "http", port: port, targetPort: 8080))
.WithVolume("raygun-data", "/app/raygun")
.ExcludeFromManifest()
diff --git a/src/RaygunAspireWebApp/Controllers/HomeController.cs b/src/RaygunAspireWebApp/Controllers/HomeController.cs
index 3a51501..149fa9d 100644
--- a/src/RaygunAspireWebApp/Controllers/HomeController.cs
+++ b/src/RaygunAspireWebApp/Controllers/HomeController.cs
@@ -62,7 +62,7 @@ private ErrorInstanceRow ConvertFileInfoToErrorInstance(FileInfo fileInfo)
fileName = fileName.Substring(index + 1);
}
- string decodedFilename = HttpUtility.UrlDecode(fileName);
+ var decodedFilename = HttpUtility.UrlDecode(fileName);
if (decodedFilename.EndsWith(".json"))
{
@@ -71,7 +71,7 @@ private ErrorInstanceRow ConvertFileInfoToErrorInstance(FileInfo fileInfo)
return new ErrorInstanceRow
{
- Timestamp = fileInfo.LastWriteTime,
+ Timestamp = fileInfo.LastWriteTimeUtc,
Name = decodedFilename,
Id = id
};
diff --git a/src/RaygunAspireWebApp/Controllers/IngestionController.cs b/src/RaygunAspireWebApp/Controllers/IngestionController.cs
index 6d577ea..a7803f4 100644
--- a/src/RaygunAspireWebApp/Controllers/IngestionController.cs
+++ b/src/RaygunAspireWebApp/Controllers/IngestionController.cs
@@ -25,7 +25,7 @@ public async Task Entries()
try
{
using var reader = new StreamReader(Request.Body, Encoding.UTF8);
- string requestBody = await reader.ReadToEndAsync();
+ var requestBody = await reader.ReadToEndAsync();
var raygunMessage = JsonSerializer.Deserialize(requestBody, new JsonSerializerOptions { PropertyNameCaseInsensitive = true, Converters = { new RaygunIdentifierMessageConverter() } });
@@ -41,9 +41,17 @@ public async Task Entries()
message = "Unknown error";
}
- string noAsterisk = message.Replace("*", "");
- string encodedMessage = HttpUtility.UrlEncode(noAsterisk);
- System.IO.File.WriteAllText($"{ErrorsFolderPath}/{uniqueSlug}-{encodedMessage}.json", requestBody);
+ var noAsterisk = message.Replace("*", "");
+ var encodedMessage = HttpUtility.UrlEncode(noAsterisk);
+
+ var fileName = BuildFileName(uniqueSlug, encodedMessage);
+ if (fileName.Length > 255)
+ {
+ encodedMessage = encodedMessage.Substring(0, encodedMessage.Length - (fileName.Length - 255) - 3) + "...";
+ fileName = BuildFileName(uniqueSlug, encodedMessage);
+ }
+
+ System.IO.File.WriteAllText($"{ErrorsFolderPath}/{fileName}", requestBody);
EnforceRetentionAsync();
}
@@ -57,6 +65,11 @@ public async Task Entries()
return Accepted();
}
+ private string BuildFileName(long uniqueSlug, string encodedMessage)
+ {
+ return $"{uniqueSlug}-{encodedMessage}.json";
+ }
+
private static void EnforceRetentionAsync()
{
var files = Directory.GetFiles(ErrorsFolderPath)
diff --git a/src/RaygunAspireWebApp/RaygunAspireWebApp.csproj b/src/RaygunAspireWebApp/RaygunAspireWebApp.csproj
index 38345c0..f907ecc 100644
--- a/src/RaygunAspireWebApp/RaygunAspireWebApp.csproj
+++ b/src/RaygunAspireWebApp/RaygunAspireWebApp.csproj
@@ -5,7 +5,7 @@
enable
enable
Linux
- 2.0.1
+ 2.0.2