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

Commit

Permalink
stacktrace: unescape pack after splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
shihanng authored and dcramer committed Oct 23, 2018
1 parent adb5dff commit 3033899
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions stacktrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"bytes"
"go/build"
"io/ioutil"
"net/url"
"path/filepath"
"runtime"
"strings"
Expand Down Expand Up @@ -188,6 +189,10 @@ func splitFunctionName(name string) (string, string) {
name = name[pos+1:]
}

if p, err := url.QueryUnescape(pack); err == nil {
pack = p
}

return pack, name
}

Expand Down
3 changes: 2 additions & 1 deletion stacktrace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func TestSplitFunctionName(t *testing.T) {
{"cmd/main.main.func1.1.1", "cmd/main", "main.func1.1.1"},
{"cmd/main.(*T).Do", "cmd/main", "(*T).Do"},
{"cmd/main.*T.Do", "cmd/main", "*T.Do"},
{`github.com/getsentry/dot%2epackage.*T.Do`, "github.com/getsentry/dot.package", "*T.Do"},
}

for _, test := range tests {
Expand Down Expand Up @@ -93,7 +94,7 @@ func TestStacktrace(t *testing.T) {
if f.Module != thisPackage {
t.Error("incorrect Module:", f.Module)
}
if f.Lineno != 121 {
if f.Lineno != 122 {
t.Error("incorrect Lineno:", f.Lineno)
}
if f.ContextLine != "\treturn NewStacktrace(0, 2, []string{thisPackage})" {
Expand Down

0 comments on commit 3033899

Please # to comment.