File tree Expand file tree Collapse file tree
flutter/lib/src/event_processor/url_filter Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import 'dart:html' as html show window, Window;
2+
3+ import '../../../sentry_flutter.dart' ;
4+ import 'url_filter_event_processor.dart' ;
5+ // ignore: implementation_imports
6+ import 'package:sentry/src//utils/regex_utils.dart' ;
7+
8+ // ignore_for_file: invalid_use_of_internal_member
9+
10+ UrlFilterEventProcessor urlFilterEventProcessor (SentryFlutterOptions options) =>
11+ WebUrlFilterEventProcessor (options);
12+
13+ class WebUrlFilterEventProcessor implements UrlFilterEventProcessor {
14+ WebUrlFilterEventProcessor (
15+ this ._options,
16+ );
17+
18+ final html.Window _window = html.window;
19+
20+ final SentryFlutterOptions _options;
21+
22+ @override
23+ SentryEvent ? apply (SentryEvent event, Hint hint) {
24+ final url = event.request? .url ?? _window.location.toString ();
25+
26+ if (_options.allowUrls.isNotEmpty &&
27+ ! isMatchingRegexPattern (url, _options.allowUrls)) {
28+ return null ;
29+ }
30+
31+ if (_options.denyUrls.isNotEmpty &&
32+ isMatchingRegexPattern (url, _options.denyUrls)) {
33+ return null ;
34+ }
35+
36+ return event;
37+ }
38+ }
Original file line number Diff line number Diff line change 11import '../../../sentry_flutter.dart' ;
22import 'io_url_filter_event_processor.dart'
3- if (dart.library.html) 'web_url_filter_event_processor.dart' ;
3+ if (dart.library.html) 'html_url_filter_event_processor.dart'
4+ if (dart.library.js_interop) 'web_url_filter_event_processor.dart' ;
45
56abstract class UrlFilterEventProcessor implements EventProcessor {
67 factory UrlFilterEventProcessor (SentryFlutterOptions options) =>
You can’t perform that action at this time.
0 commit comments