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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
42ebd902
Commit
42ebd902
authored
Jul 28, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug causing Bitbucket importer to crash when OAuth application had been removed.
parent
43d11880
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
CHANGELOG
CHANGELOG
+1
-0
app/controllers/import/bitbucket_controller.rb
app/controllers/import/bitbucket_controller.rb
+1
-0
lib/gitlab/bitbucket_import/client.rb
lib/gitlab/bitbucket_import/client.rb
+15
-6
No files found.
CHANGELOG
View file @
42ebd902
...
@@ -16,6 +16,7 @@ v 7.14.0 (unreleased)
...
@@ -16,6 +16,7 @@ v 7.14.0 (unreleased)
- Expire Rails cache entries after two weeks to prevent endless Redis growth
- Expire Rails cache entries after two weeks to prevent endless Redis growth
- Add support for destroying project milestones (Stan Hu)
- Add support for destroying project milestones (Stan Hu)
- Add fetch command to the MR page
- Add fetch command to the MR page
- Fix bug causing Bitbucket importer to crash when OAuth application had been removed.
v 7.13.1
v 7.13.1
- Fix: Label modifications are not reflected in existing notes and in the issue list
- Fix: Label modifications are not reflected in existing notes and in the issue list
...
...
app/controllers/import/bitbucket_controller.rb
View file @
42ebd902
...
@@ -3,6 +3,7 @@ class Import::BitbucketController < Import::BaseController
...
@@ -3,6 +3,7 @@ class Import::BitbucketController < Import::BaseController
before_action
:bitbucket_auth
,
except: :callback
before_action
:bitbucket_auth
,
except: :callback
rescue_from
OAuth
::
Error
,
with: :bitbucket_unauthorized
rescue_from
OAuth
::
Error
,
with: :bitbucket_unauthorized
rescue_from
Gitlab
::
BitbucketImport
::
Client
::
Unauthorized
,
with: :bitbucket_unauthorized
def
callback
def
callback
request_token
=
session
.
delete
(
:oauth_request_token
)
request_token
=
session
.
delete
(
:oauth_request_token
)
...
...
lib/gitlab/bitbucket_import/client.rb
View file @
42ebd902
module
Gitlab
module
Gitlab
module
BitbucketImport
module
BitbucketImport
class
Client
class
Client
class
Unauthorized
<
StandardError
;
end
attr_reader
:consumer
,
:api
attr_reader
:consumer
,
:api
def
initialize
(
access_token
=
nil
,
access_token_secret
=
nil
)
def
initialize
(
access_token
=
nil
,
access_token_secret
=
nil
)
...
@@ -46,23 +48,23 @@ module Gitlab
...
@@ -46,23 +48,23 @@ module Gitlab
end
end
def
user
def
user
JSON
.
parse
(
api
.
get
(
"/api/1.0/user"
).
body
)
JSON
.
parse
(
get
(
"/api/1.0/user"
).
body
)
end
end
def
issues
(
project_identifier
)
def
issues
(
project_identifier
)
JSON
.
parse
(
api
.
get
(
"/api/1.0/repositories/
#{
project_identifier
}
/issues"
).
body
)
JSON
.
parse
(
get
(
"/api/1.0/repositories/
#{
project_identifier
}
/issues"
).
body
)
end
end
def
issue_comments
(
project_identifier
,
issue_id
)
def
issue_comments
(
project_identifier
,
issue_id
)
JSON
.
parse
(
api
.
get
(
"/api/1.0/repositories/
#{
project_identifier
}
/issues/
#{
issue_id
}
/comments"
).
body
)
JSON
.
parse
(
get
(
"/api/1.0/repositories/
#{
project_identifier
}
/issues/
#{
issue_id
}
/comments"
).
body
)
end
end
def
project
(
project_identifier
)
def
project
(
project_identifier
)
JSON
.
parse
(
api
.
get
(
"/api/1.0/repositories/
#{
project_identifier
}
"
).
body
)
JSON
.
parse
(
get
(
"/api/1.0/repositories/
#{
project_identifier
}
"
).
body
)
end
end
def
find_deploy_key
(
project_identifier
,
key
)
def
find_deploy_key
(
project_identifier
,
key
)
JSON
.
parse
(
api
.
get
(
"/api/1.0/repositories/
#{
project_identifier
}
/deploy-keys"
).
body
).
find
do
|
deploy_key
|
JSON
.
parse
(
get
(
"/api/1.0/repositories/
#{
project_identifier
}
/deploy-keys"
).
body
).
find
do
|
deploy_key
|
deploy_key
[
"key"
].
chomp
==
key
.
chomp
deploy_key
[
"key"
].
chomp
==
key
.
chomp
end
end
end
end
...
@@ -82,11 +84,18 @@ module Gitlab
...
@@ -82,11 +84,18 @@ module Gitlab
end
end
def
projects
def
projects
JSON
.
parse
(
api
.
get
(
"/api/1.0/user/repositories"
).
body
).
select
{
|
repo
|
repo
[
"scm"
]
==
"git"
}
JSON
.
parse
(
get
(
"/api/1.0/user/repositories"
).
body
).
select
{
|
repo
|
repo
[
"scm"
]
==
"git"
}
end
end
private
private
def
get
(
url
)
response
=
api
.
get
(
url
)
raise
Unauthorized
if
(
400
..
499
).
include?
(
response
.
code
.
to_i
)
response
end
def
config
def
config
Gitlab
.
config
.
omniauth
.
providers
.
find
{
|
provider
|
provider
.
name
==
"bitbucket"
}
Gitlab
.
config
.
omniauth
.
providers
.
find
{
|
provider
|
provider
.
name
==
"bitbucket"
}
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