Skip to content

Commit

Permalink
don't backtick quote stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed Oct 19, 2023
1 parent d503282 commit 95bc919
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion server/ctrladmin/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
4 changes: 2 additions & 2 deletions server/ctrlsubsonic/ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/ctrlsubsonic/handlers_by_folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down
6 changes: 3 additions & 3 deletions server/ctrlsubsonic/handlers_by_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions server/ctrlsubsonic/handlers_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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
}

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 95bc919

Please sign in to comment.