Browse Source

fix(grouping): Add `applewebdata` to Stacktrace `is_url` check (#6466)

ted kaemming 7 years ago
parent
commit
2adce34348
2 changed files with 13 additions and 2 deletions
  1. 1 1
      src/sentry/interfaces/stacktrace.py
  2. 12 1
      tests/sentry/interfaces/test_stacktrace.py

+ 1 - 1
src/sentry/interfaces/stacktrace.py

@@ -141,7 +141,7 @@ def is_newest_frame_first(event):
 
 
 def is_url(filename):
-    return filename.startswith(('file:', 'http:', 'https:'))
+    return filename.startswith(('file:', 'http:', 'https:', 'applewebdata:'))
 
 
 def remove_function_outliers(function):

+ 12 - 1
tests/sentry/interfaces/test_stacktrace.py

@@ -9,11 +9,22 @@ from django.template.loader import render_to_string
 from exam import fixture
 
 from sentry.interfaces.base import InterfaceValidationError
-from sentry.interfaces.stacktrace import (Frame, Stacktrace, get_context, slim_frame_data)
+from sentry.interfaces.stacktrace import (Frame, Stacktrace, get_context, is_url, slim_frame_data)
 from sentry.models import Event
 from sentry.testutils import TestCase
 
 
+def test_is_url():
+    assert is_url('http://example.org/') is True
+    assert is_url('https://example.org/') is True
+    assert is_url('file:///tmp/filename') is True
+    assert is_url('applewebdata://00000000-0000-1000-8080-808080808080') is True
+    assert is_url('app:///index.bundle') is False   # react native
+    assert is_url('webpack:///./app/index.jsx') is False  # webpack bundle
+    assert is_url('data:,') is False
+    assert is_url('blob:\x00') is False
+
+
 class GetContextTest(TestCase):
     def test_works_with_empty_filename(self):
         result = get_context(0, 'hello world')