mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Anonymize URL when reporting message to sentry.io
This commit is contained in:
parent
483ef8b2f6
commit
9507f4c985
1 changed files with 20 additions and 1 deletions
|
|
@ -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()) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue