Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
now lists s3 buckets properly with download option
Browse files Browse the repository at this point in the history
  • Loading branch information
moomerman committed Oct 28, 2008
1 parent 0942ea0 commit 18661cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 11 additions & 3 deletions snail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,15 @@
erb :buckets
end

get '/bucket/:name/keys' do
@output = @s3.bucket(params[:name]).keys.map{|k| k.name}
erb :dump
get '/bucket/:bucket_name/keys' do
@bucket = @s3.bucket(params[:bucket_name])
@keys = @bucket.keys
erb :s3_keys
end

get '/bucket/*/key/*' do
bucket_name = request.path_info.split('/')[2]
key_name = request.path_info.split('/')[4]
@bucket = @s3.bucket(bucket_name)
send_data(@bucket.get(key_name))
end
3 changes: 3 additions & 0 deletions views/s3_keys.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<% @keys.each do |key| %>
<%= key.name %> <%= link_to('link', key.public_link) %> <%= link_to 'download', "/bucket/#{@bucket.name}/key/#{key.name}" %><br/>
<% end %>

0 comments on commit 18661cb

Please sign in to comment.