Skip to content

Commit

Permalink
Fix small bug in the controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Feb 12, 2012
1 parent f2dc2f0 commit d81ba19
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/app.rb
Expand Up @@ -18,13 +18,15 @@
end

get '/:user/:repository' do
populate fetch "https://github.com/api/v2/json/repos/show/#{URI.escape params[:user]}/#{URI.escape params[:repository]}/contributors"
data = fetch "https://github.com/api/v2/json/repos/show/#{URI.escape params[:user]}/#{URI.escape params[:repository]}/contributors"

if @data.has_key? 'error'
if data.has_key? 'error'
@title = 'Not Found...'

haml :not_found
else
populate data

@title = "#{params[:user]}/#{params[:repository]}"
@tags = fetch_tags

Expand All @@ -33,14 +35,17 @@
end

get '/:user/:repository/:tag' do
populate fetch "https://github.com/api/v2/json/repos/show/#{URI.escape params[:user]}/#{URI.escape params[:repository]}/contributors"
tagger

if @tag.commits.include? 'error'
data = fetch "https://github.com/api/v2/json/repos/show/#{URI.escape params[:user]}/#{URI.escape params[:repository]}/contributors"

if data.has_key? 'error' or @tag.commits.include? 'error'
@title = 'Not found...'

haml :not_found
else
populate data

@title = "#{params[:user]}/#{params[:repository]} #{params[:tag]}"
@tags = fetch_tags

Expand Down

0 comments on commit d81ba19

Please sign in to comment.