don't backtick quote stuff
This commit is contained in:
@@ -253,11 +253,11 @@ func (s *Scanner) scanCallback(c *Context, dir string, absPath string, d fs.DirE
|
||||
}
|
||||
|
||||
if s.excludePattern != nil && s.excludePattern.MatchString(absPath) {
|
||||
log.Printf("excluding folder `%s`", absPath)
|
||||
log.Printf("excluding folder %q", absPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Printf("processing folder `%s`", absPath)
|
||||
log.Printf("processing folder %q", absPath)
|
||||
|
||||
tx := s.db.Begin()
|
||||
if err := s.scanDir(tx, c, dir, absPath); err != nil {
|
||||
@@ -283,7 +283,7 @@ func (s *Scanner) scanDir(tx *db.DB, c *Context, musicDir string, absPath string
|
||||
for _, item := range items {
|
||||
absPath := filepath.Join(absPath, item.Name())
|
||||
if s.excludePattern != nil && s.excludePattern.MatchString(absPath) {
|
||||
log.Printf("excluding path `%s`", absPath)
|
||||
log.Printf("excluding path %q", absPath)
|
||||
continue
|
||||
}
|
||||
if item.IsDir() {
|
||||
|
||||
@@ -312,7 +312,7 @@ func (c *Controller) ServeCreateUserDo(r *http.Request) *Response {
|
||||
if err := c.dbc.Create(&user).Error; err != nil {
|
||||
return &Response{
|
||||
redirect: r.Referer(),
|
||||
flashW: []string{fmt.Sprintf("could not create user `%s`: %v", username, err)},
|
||||
flashW: []string{fmt.Sprintf("could not create user %q: %v", username, err)},
|
||||
}
|
||||
}
|
||||
return &Response{redirect: "/admin/home"}
|
||||
|
||||
@@ -206,7 +206,7 @@ func withRequiredParams(next http.Handler) http.Handler {
|
||||
params := r.Context().Value(CtxParams).(params.Params)
|
||||
for _, req := range requiredParameters {
|
||||
if _, err := params.Get(req); err != nil {
|
||||
_ = writeResp(w, r, spec.NewError(10, "please provide a `%s` parameter", req))
|
||||
_ = writeResp(w, r, spec.NewError(10, "please provide a %q parameter", req))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -234,7 +234,7 @@ func withUser(dbc *db.DB) handlerutil.Middleware {
|
||||
user := dbc.GetUserByName(username)
|
||||
if user == nil {
|
||||
_ = writeResp(w, r, spec.NewError(40,
|
||||
"invalid username `%s`", username))
|
||||
"invalid username %q", username))
|
||||
return
|
||||
}
|
||||
var credsOk bool
|
||||
|
||||
@@ -160,7 +160,7 @@ func (c *Controller) ServeGetAlbumList(r *http.Request) *spec.Response {
|
||||
q = q.Joins("JOIN album_stars ON albums.id=album_stars.album_id AND album_stars.user_id=?", user.ID)
|
||||
q = q.Order("right_path")
|
||||
default:
|
||||
return spec.NewError(10, "unknown value `%s` for parameter 'type'", v)
|
||||
return spec.NewError(10, "unknown value %q for parameter 'type'", v)
|
||||
}
|
||||
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
|
||||
@@ -174,7 +174,7 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response {
|
||||
q = q.Joins("JOIN album_stars ON albums.id=album_stars.album_id AND album_stars.user_id=?", user.ID)
|
||||
q = q.Order("tag_title")
|
||||
default:
|
||||
return spec.NewError(10, "unknown value `%s` for parameter 'type'", listType)
|
||||
return spec.NewError(10, "unknown value %q for parameter 'type'", listType)
|
||||
}
|
||||
if m := getMusicFolder(c.musicPaths, params); m != "" {
|
||||
q = q.Where("root_dir=?", m)
|
||||
@@ -314,7 +314,7 @@ func (c *Controller) ServeGetArtistInfoTwo(r *http.Request) *spec.Response {
|
||||
Find(&artist).
|
||||
Error
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return spec.NewError(70, "artist with id `%s` not found", id)
|
||||
return spec.NewError(70, "artist with id %q not found", id)
|
||||
}
|
||||
|
||||
sub := spec.NewResponse()
|
||||
@@ -665,7 +665,7 @@ func (c *Controller) ServeGetSimilarSongsTwo(r *http.Request) *spec.Response {
|
||||
First(&artist).
|
||||
Error
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return spec.NewError(0, "artist with id `%s` not found", id)
|
||||
return spec.NewError(0, "artist with id %q not found", id)
|
||||
}
|
||||
|
||||
similarArtists, err := c.lastFMClient.ArtistGetSimilar(artist.Name)
|
||||
|
||||
@@ -51,7 +51,7 @@ func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *s
|
||||
case os.IsNotExist(err):
|
||||
reader, err := coverFor(c.dbc, c.artistInfoCache, id)
|
||||
if err != nil {
|
||||
return spec.NewError(10, "couldn't find cover `%s`: %v", id, err)
|
||||
return spec.NewError(10, "couldn't find cover %q: %v", id, err)
|
||||
}
|
||||
defer reader.Close()
|
||||
|
||||
@@ -60,7 +60,7 @@ func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *s
|
||||
return nil
|
||||
}
|
||||
case err != nil:
|
||||
log.Printf("error stating `%s`: %v", cachePath, err)
|
||||
log.Printf("error stating %q: %v", cachePath, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ func coverScaleAndSave(reader io.Reader, cachePath string, size int) error {
|
||||
width = src.Bounds().Dx()
|
||||
}
|
||||
if err = imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil {
|
||||
return fmt.Errorf("caching `%s`: %w", cachePath, err)
|
||||
return fmt.Errorf("caching %q: %w", cachePath, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user