mirror of
https://git.sr.ht/~sircmpwn/tokidoki
synced 2025-12-12 06:07:22 +01:00
Switch to a proper logging library
Structured logs can be enabled with `-log.json`.
This commit is contained in:
parent
03fce79e57
commit
40bae8dc31
9 changed files with 75 additions and 64 deletions
|
|
@ -11,11 +11,11 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/emersion/go-webdav"
|
||||
"github.com/emersion/go-webdav/caldav"
|
||||
"github.com/emersion/go-webdav/carddav"
|
||||
|
||||
"git.sr.ht/~sircmpwn/tokidoki/debug"
|
||||
)
|
||||
|
||||
type filesystemBackend struct {
|
||||
|
|
@ -83,7 +83,7 @@ func (b *filesystemBackend) safeLocalPath(homeSetPath string, urlPath string) (s
|
|||
}
|
||||
// only accept simple file names for now
|
||||
if !validFilenameRegex.MatchString(file) {
|
||||
debug.Printf("%s does not match regex!\n", file)
|
||||
log.Debug().Str("file", file).Msg("file name does not match regex")
|
||||
err := fmt.Errorf("invalid file name: %s", file)
|
||||
return "", webdav.NewHTTPError(400, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue