Skip to content

Commit

Permalink
Merge pull request #5 from parabuzzle/fix_slash_bug/issue_4
Browse files Browse the repository at this point in the history
handle slashes in container name
  • Loading branch information
parabuzzle committed May 17, 2016
2 parents ef10308 + fd69aea commit 1b0e8b4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
10 changes: 5 additions & 5 deletions public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
<title>Crane Operator Not Found</title>

<!-- bootstrap css -->
<link rel="stylesheet" href="bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/bootstrap.min.css" crossorigin="anonymous">

<!-- bootstrap theme -->
<link rel="stylesheet" href="bootstrap-theme.css" crossorigin="anonymous">
<link rel="stylesheet" href="/bootstrap-theme.css" crossorigin="anonymous">

<!-- application css -->
<link rel="stylesheet" href="app.css" crossorigin="anonymous">
<link rel="stylesheet" href="/app.css" crossorigin="anonymous">

</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<img class="navbar-brand" src="mini-logo.svg">
<img class="navbar-brand" src="/mini-logo.svg">
<a href="/" class="navbar-brand">Crane Operator</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
Expand All @@ -34,7 +34,7 @@ <h1>Not Found</h1>
</div>
<div>
<br/><br/>
<img class="img-responsive" src="404.png"/>
<img class="img-responsive" src="/404.png"/>
</div>
</div>
</body>
Expand Down
6 changes: 3 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<title>Crane Operator</title>

<!-- bootstrap css -->
<link rel="stylesheet" href="bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/bootstrap.min.css" crossorigin="anonymous">

<!-- bootstrap theme -->
<link rel="stylesheet" href="bootstrap-theme.css" crossorigin="anonymous">
<link rel="stylesheet" href="/bootstrap-theme.css" crossorigin="anonymous">

<!-- application css -->
<link rel="stylesheet" href="app.css" crossorigin="anonymous">
<link rel="stylesheet" href="/app.css" crossorigin="anonymous">

</head>
<body>
Expand Down
9 changes: 7 additions & 2 deletions server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,20 @@ def container_info(repo, manifest)
containers.to_json
end

get '/container/:container/tags.json' do |container|
get '/container/*/tags.json' do |container|
content_type :json

tags = container_tags(container)
halt 404 if tags.nil?
tags.to_json
end

get '/container/:container/:tag.json' do |container, tag|
get /container\/(.*\/)(.*.json)/ do |container, tag|

# This is here because we need to handle slashes in container names
container.chop!
tag.gsub!('.json', '')

content_type :json

info = container_info(container, tag)
Expand Down

0 comments on commit 1b0e8b4

Please sign in to comment.