Skip to content

Commit 478d45a

Browse files
committed
Fix forbidden/unauthorized http status mixup
1 parent 6c00320 commit 478d45a

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

rails/app/controllers/tiddlywiki_controller.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,10 @@ def site_not_available_status
201201
return [404, 'Not Found'] if action_name == 'download' && site_visible? && site_download_url_disabled?
202202

203203
# User signed in, site unavailable
204-
# Fixme: Actually the name is wrong, should be [403, 'Forbidden']
205-
return [403, 'Unauthorized'] if user_signed_in?
204+
return [403, 'Forbidden'] if user_signed_in?
206205

207206
# User not signed in, site unavailable
208-
# Fixme: Actually the name is wrong, should be [401, 'Unauthorized']
209-
[401, 'Forbidden']
207+
[401, 'Unauthorized']
210208
end
211209

212210
def site_visible?

rails/test/integration/sites_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ def assert_is_404
192192
end
193193

194194
def assert_is_401
195-
assert_is_status(401, 'Forbidden')
195+
assert_is_status(401, 'Unauthorized')
196196
end
197197

198198
def assert_is_403
199-
assert_is_status(403, 'Unauthorized')
199+
assert_is_status(403, 'Forbidden')
200200
end
201201

202202
def assert_is_status(status_code, status_message)

0 commit comments

Comments
 (0)