diff options
author | Unknwon <u@gogs.io> | 2017-06-02 17:19:06 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-06-02 17:19:06 -0400 |
commit | c4079216440af73c03343f53a6a4734688c87b60 (patch) | |
tree | b60ddfa5447ddc1d97dd01df487e357f72b289e8 /pkg/markup | |
parent | a1411c36de204794247a96adde2817ea2b062d0e (diff) |
orgmode: recover panic from third-party package
Diffstat (limited to 'pkg/markup')
-rw-r--r-- | pkg/markup/orgmode.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/markup/orgmode.go b/pkg/markup/orgmode.go index c7f62f50..f62cced2 100644 --- a/pkg/markup/orgmode.go +++ b/pkg/markup/orgmode.go @@ -8,6 +8,8 @@ import ( "path/filepath" "strings" + log "gopkg.in/clog.v1" + "github.com/chaseadamsio/goorgeous" ) @@ -25,7 +27,14 @@ func IsOrgModeFile(name string) bool { } // RawOrgMode renders content in Org-mode syntax to HTML without handling special links. -func RawOrgMode(body []byte, urlPrefix string) []byte { +func RawOrgMode(body []byte, urlPrefix string) (result []byte) { + // TODO: remove recover code once the third-party package is stable + defer func() { + if err := recover(); err != nil { + result = body + log.Warn("PANIC (RawOrgMode): %v", err) + } + }() return goorgeous.OrgCommon(body) } |