Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
b03ee466
Commit
b03ee466
authored
Aug 29, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle invalid ssh exception
parent
c48c0f95
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+4
-0
app/views/errors/invalid_ssh_key.html.haml
app/views/errors/invalid_ssh_key.html.haml
+3
-0
lib/gitlab/backend/gitolite.rb
lib/gitlab/backend/gitolite.rb
+7
-2
No files found.
app/controllers/application_controller.rb
View file @
b03ee466
...
...
@@ -14,6 +14,10 @@ class ApplicationController < ActionController::Base
render
"errors/gitolite"
,
layout:
"error"
end
rescue_from
Gitlab
::
Gitolite
::
InvalidKey
do
|
exception
|
render
"errors/invalid_ssh_key"
,
layout:
"error"
end
rescue_from
Encoding
::
CompatibilityError
do
|
exception
|
render
"errors/encoding"
,
layout:
"error"
,
status:
404
end
...
...
app/views/errors/invalid_ssh_key.html.haml
0 → 100644
View file @
b03ee466
%h1
Git Error
%hr
%p
Seems like SSH Key you provided is not a valid SSH key.
lib/gitlab/backend/gitolite.rb
View file @
b03ee466
...
...
@@ -6,6 +6,7 @@ require 'fileutils'
module
Gitlab
class
Gitolite
class
AccessDenied
<
StandardError
;
end
class
InvalidKey
<
StandardError
;
end
def
set_key
key_id
,
key_content
,
projects
configure
do
|
c
|
...
...
@@ -190,8 +191,12 @@ module Gitlab
end
end
rescue
Exception
=>
ex
Gitlab
::
Logger
.
error
(
ex
.
message
)
raise
Gitolite
::
AccessDenied
.
new
(
"gitolite timeout"
)
if
ex
.
message
=~
/is not a valid SSH key string/
raise
Gitolite
::
InvalidKey
.
new
(
"ssh key is not valid"
)
else
Gitlab
::
Logger
.
error
(
ex
.
message
)
raise
Gitolite
::
AccessDenied
.
new
(
"gitolite timeout"
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment