Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit 3033899

Browse files
shihanngdcramer
authored andcommitted
stacktrace: unescape pack after splitting
1 parent adb5dff commit 3033899

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

stacktrace.go

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"bytes"
1010
"go/build"
1111
"io/ioutil"
12+
"net/url"
1213
"path/filepath"
1314
"runtime"
1415
"strings"
@@ -188,6 +189,10 @@ func splitFunctionName(name string) (string, string) {
188189
name = name[pos+1:]
189190
}
190191

192+
if p, err := url.QueryUnescape(pack); err == nil {
193+
pack = p
194+
}
195+
191196
return pack, name
192197
}
193198

stacktrace_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func TestSplitFunctionName(t *testing.T) {
6161
{"cmd/main.main.func1.1.1", "cmd/main", "main.func1.1.1"},
6262
{"cmd/main.(*T).Do", "cmd/main", "(*T).Do"},
6363
{"cmd/main.*T.Do", "cmd/main", "*T.Do"},
64+
{`github.com/getsentry/dot%2epackage.*T.Do`, "github.com/getsentry/dot.package", "*T.Do"},
6465
}
6566

6667
for _, test := range tests {
@@ -93,7 +94,7 @@ func TestStacktrace(t *testing.T) {
9394
if f.Module != thisPackage {
9495
t.Error("incorrect Module:", f.Module)
9596
}
96-
if f.Lineno != 121 {
97+
if f.Lineno != 122 {
9798
t.Error("incorrect Lineno:", f.Lineno)
9899
}
99100
if f.ContextLine != "\treturn NewStacktrace(0, 2, []string{thisPackage})" {

0 commit comments

Comments
 (0)