mirror of
https://github.com/yusing/godoxy.git
synced 2026-01-11 22:30:47 +01:00
fix(notif): use markdown format if invalid
This commit is contained in:
@@ -30,7 +30,7 @@ var (
|
||||
|
||||
// Validate implements the utils.CustomValidator interface.
|
||||
func (base *ProviderBase) Validate() gperr.Error {
|
||||
if base.Format == nil {
|
||||
if base.Format == nil || base.Format.string == "" {
|
||||
base.Format = LogFormatMarkdown
|
||||
}
|
||||
if !strings.HasPrefix(base.URL, "http://") && !strings.HasPrefix(base.URL, "https://") {
|
||||
|
||||
@@ -3,7 +3,6 @@ package notif
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/yusing/go-proxy/internal/gperr"
|
||||
@@ -126,5 +125,5 @@ func (e ErrorBody) Format(format *LogFormat) ([]byte, error) {
|
||||
case LogFormatMarkdown:
|
||||
return gperr.Markdown(e.Error), nil
|
||||
}
|
||||
return nil, fmt.Errorf("unknown format: %v", format)
|
||||
return gperr.Markdown(e.Error), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user