diff --git a/src/BUTR.CrashReport/CrashReportInfo.cs b/src/BUTR.CrashReport/CrashReportInfo.cs index a18d294..d0aab42 100644 --- a/src/BUTR.CrashReport/CrashReportInfo.cs +++ b/src/BUTR.CrashReport/CrashReportInfo.cs @@ -143,8 +143,11 @@ public static CrashReportInfo Create(Exception exception, Dictionary private CrashReportInfo(Exception exception, Dictionary additionalMetadata, - IStacktraceFilter stacktraceFilter, IAssemblyUtilities assemblyUtilities, - IModuleProvider moduleProvider, ILoaderPluginProvider loaderPluginProvider, IHarmonyProvider harmonyProvider) + IStacktraceFilter stacktraceFilter, + IAssemblyUtilities assemblyUtilities, + IModuleProvider moduleProvider, + ILoaderPluginProvider loaderPluginProvider, + IHarmonyProvider harmonyProvider) { var assemblies = assemblyUtilities.Assemblies().ToArray(); diff --git a/src/BUTR.CrashReport/Utils/Anonymizer.cs b/src/BUTR.CrashReport/Utils/Anonymizer.cs index 98755d2..477b7ae 100644 --- a/src/BUTR.CrashReport/Utils/Anonymizer.cs +++ b/src/BUTR.CrashReport/Utils/Anonymizer.cs @@ -83,7 +83,7 @@ public void Add(string? path, string name) /// The anonymized path. public static string AnonymizePath(string path) { - var normalizedPath = path; + var normalizedPath = path.NormalizePath(); var entries = SplitWithIndex(normalizedPath, Path.DirectorySeparatorChar); foreach (var kv in AnonymizationPaths) diff --git a/src/BUTR.CrashReport/Utils/CrashReportModelUtils.cs b/src/BUTR.CrashReport/Utils/CrashReportModelUtils.cs index 36c6312..dde1701 100644 --- a/src/BUTR.CrashReport/Utils/CrashReportModelUtils.cs +++ b/src/BUTR.CrashReport/Utils/CrashReportModelUtils.cs @@ -265,9 +265,10 @@ static bool IsProtectedFromDisassembly(Assembly assembly) type = assemblyUtilities.GetAssemblyType(type, crashReport, assembly); - var anonymizedPath = !assembly.IsDynamic ? assembly.Location : string.Empty; - if (!assembly.IsDynamic && !pathAnonymizer.TryHandlePath(anonymizedPath, out anonymizedPath)) - anonymizedPath = Anonymizer.AnonymizePath(anonymizedPath); + var path = !assembly.IsDynamic ? assembly.Location : string.Empty; + var anonymizedPath = string.Empty; + if (!assembly.IsDynamic && !pathAnonymizer.TryHandlePath(path, out anonymizedPath)) + anonymizedPath = Anonymizer.AnonymizePath(path); assemblyModels.Add(new() { diff --git a/src/BUTR.CrashReport/Utils/NativeModuleUtils.cs b/src/BUTR.CrashReport/Utils/NativeModuleUtils.cs index 0cb5a6d..4fa34f6 100644 --- a/src/BUTR.CrashReport/Utils/NativeModuleUtils.cs +++ b/src/BUTR.CrashReport/Utils/NativeModuleUtils.cs @@ -46,8 +46,10 @@ public static List CollectModules(Process process, IPathAnonymizer var version = x.FileVersionInfo.FileVersion ?? x.FileVersionInfo.ProductVersion; - if (!pathAnonymizer.TryHandlePath(x.FileName, out var anonymizedPath)) - anonymizedPath = Anonymizer.AnonymizePath(x.FileName); + var path = x.FileName; + var anonymizedPath = string.Empty; + if (!pathAnonymizer.TryHandlePath(path, out anonymizedPath)) + anonymizedPath = Anonymizer.AnonymizePath(path); return new NativeModule(x.ModuleName, anonymizedPath, version, arch, (uint) fs.Length, x.BaseAddress, (uint) x.ModuleMemorySize, hash); }