From 902f0c115b0b0f7f662262c762d075000b679832 Mon Sep 17 00:00:00 2001 From: ta264 Date: Mon, 11 Mar 2019 16:19:12 +0000 Subject: [PATCH] Fixed: Sentry version mismatch (#666) * Downgrade to 1.0.3 * Fix ShortenPath when cross-compiled --- .../Instrumentation/Sentry/SentryCleanser.cs | 17 +++++++++++------ src/NzbDrone.Common/NzbDrone.Common.csproj | 4 ++-- src/NzbDrone.Common/packages.config | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryCleanser.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryCleanser.cs index 96a6df420..d96958ec5 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryCleanser.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryCleanser.cs @@ -66,15 +66,20 @@ namespace NzbDrone.Common.Instrumentation.Sentry return null; } - var rootDir = OsInfo.IsWindows ? "\\src\\" : "/src/"; - var index = path.IndexOf(rootDir, StringComparison.Ordinal); - - if (index <= 0) + // the paths in the stacktrace depend on where it was compiled, + // not the current OS + var rootDirs = new [] { "\\src\\", "/src/" }; + foreach (var rootDir in rootDirs) { - return path; + var index = path.IndexOf(rootDir, StringComparison.Ordinal); + + if (index > 0) + { + return path.Substring(index + rootDir.Length - 1); + } } - return path.Substring(index + rootDir.Length - 1); + return path; } } } diff --git a/src/NzbDrone.Common/NzbDrone.Common.csproj b/src/NzbDrone.Common/NzbDrone.Common.csproj index f7a3ea5e6..05e2a0eaf 100644 --- a/src/NzbDrone.Common/NzbDrone.Common.csproj +++ b/src/NzbDrone.Common/NzbDrone.Common.csproj @@ -57,8 +57,8 @@ ..\packages\Sentry.1.1.2\lib\net461\Sentry.dll - - ..\packages\Sentry.Protocol.1.0.4\lib\net46\Sentry.Protocol.dll + + ..\packages\Sentry.Protocol.1.0.3\lib\net46\Sentry.Protocol.dll ..\packages\Sentry.PlatformAbstractions.1.0.0\lib\net45\Sentry.PlatformAbstractions.dll diff --git a/src/NzbDrone.Common/packages.config b/src/NzbDrone.Common/packages.config index 0b18b0846..56cd6e4e1 100644 --- a/src/NzbDrone.Common/packages.config +++ b/src/NzbDrone.Common/packages.config @@ -6,6 +6,6 @@ - +