Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[server] Handle case when no entry exists in trash

Neeraj Gupta4ecc64e478e1
diff --git a/server/pkg/repo/trash.go b/server/pkg/repo/trash.go
index 5218caf55d..1c6ab6b45f 100644
--- a/server/pkg/repo/trash.go
+++ b/server/pkg/repo/trash.go
@@ -423,7 +423,7 @@ func (t *TrashRepository) EmptyTrash(ctx context.Context, userID int64, lastUpda
}
func (t *TrashRepository) GetTrashUpdatedAt(userID int64) (int64, error) {
- row := t.DB.QueryRow(`SELECT max(updated_at) FROM trash WHERE user_id = $1`, userID)
+ row := t.DB.QueryRow(`SELECT coalesce(max(updated_at),0) FROM trash WHERE user_id = $1`, userID)
var updatedAt int64
err := row.Scan(&updatedAt)
if errors.Is(err, sql.ErrNoRows) {