Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
まだicon使ってるところあった
Browse files Browse the repository at this point in the history
  • Loading branch information
acidlemon committed Nov 25, 2023
1 parent 0f3e4cb commit b7a63d8
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions webapp/go/user_handler.go
Expand Up @@ -416,11 +416,24 @@ func fillUserResponse(ctx context.Context, tx *sqlx.Tx, userModel UserModel) (Us
}

var image []byte
if err := tx.GetContext(ctx, &image, "SELECT image FROM icons WHERE user_id = ?", userModel.ID); err != nil {
if !errors.Is(err, sql.ErrNoRows) {
// if err := tx.GetContext(ctx, &image, "SELECT image FROM icons WHERE user_id = ?", userModel.ID); err != nil {
// if !errors.Is(err, sql.ErrNoRows) {
// return User{}, err
// }
// image, err = os.ReadFile(fallbackImage)
// if err != nil {
// return User{}, err
// }
// }
_, err := os.Stat(fmt.Sprintf("../img/user-%d.jpg", userModel.ID))
if err != nil {
// ないね
image, err = os.ReadFile(fallbackImage)
if err != nil {
return User{}, err
}
image, err = os.ReadFile(fallbackImage)
} else {
image, err = os.ReadFile(fmt.Sprintf("../img/user-%d.jpg", userModel.ID))
if err != nil {
return User{}, err
}
Expand Down

0 comments on commit b7a63d8

Please sign in to comment.