Skip to content

Commit

Permalink
Fix: Fix redis.get
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Apr 5, 2024
1 parent fbe10fd commit 7bf0a86
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/app/controllers/sonolus_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class SonolusController < ApplicationController
end
session_id = request.headers["Sonolus-Session"]
unless user_profile =
$redis.with { |c| c.get("sonolus_session/#{session_id}") }
$redis
.with { |c| c.get("sonolus_session/#{session_id}") }
&.then { |json| JSON.parse(json, symbolize_names: true) }
logger.warn "Invalid session id: #{session_id}"
render json: { error: "Session expired" }, status: :unauthorized
next
Expand Down

0 comments on commit 7bf0a86

Please sign in to comment.