2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Merge pull request #86 from SchrodingersGat/url-anon

Url anon
This commit is contained in:
Oliver 2022-03-10 16:20:55 +11:00 committed by GitHub
commit 6981e9d644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -87,7 +87,26 @@ Future<bool> sentryReportMessage(String message, {Map<String, String>? context})
final app_info = await getAppInfo();
final device_info = await getDeviceInfo();
print("Sending user message to Sentry: ${message}");
// Remove any sensitive information from a URL
if (context != null) {
if (context.containsKey("url")) {
final String url = context["url"] ?? "";
try {
final uri = Uri.parse(url);
// We don't care about the server address, only the path and query parameters!
// Overwrite the provided URL
context["url"] = uri.path + "?" + uri.query;
} catch (error) {
// Ignore if any errors are thrown here
}
}
}
print("Sending user message to Sentry: ${message}, ${context}");
if (isInDebugMode()) {

@ -1 +1 @@
Subproject commit 93b0123d427c39d48b19a50154ba16a5c6ca401f
Subproject commit cf9b39142bcd9f2102b7f7d663280440cd6dcd80