summaryrefslogtreecommitdiff
path: root/app/controllers/downloads_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/downloads_controller.rb')
-rw-r--r--app/controllers/downloads_controller.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/downloads_controller.rb b/app/controllers/downloads_controller.rb
index 9075de9e0..4de8476aa 100644
--- a/app/controllers/downloads_controller.rb
+++ b/app/controllers/downloads_controller.rb
@@ -26,8 +26,8 @@ class DownloadsController < ApplicationController
if all_params_satisfied?
redirect
else
- @qemu_images = collect_images RELEASES_DIR , '/*/*image.img.sig' , RELEASES_URL
- @preview_images = collect_images PREVIEWS_DIR , '/*/*.sig' , PREVIEWS_URL
+ @qemu_images = collect_images RELEASES_DIR , RELEASES_GLOB , RELEASES_URL
+ @preview_images = collect_images PREVIEWS_DIR , PREVIEWS_GLOB , PREVIEWS_URL
render :index , :layout => 'download'
end
@@ -103,7 +103,8 @@ private
end
def collect_images base_dir , glob , base_url
- (Dir.glob "#{base_dir}#{glob}").map do | sig |
+ images_sigs = Dir.glob "#{base_dir}#{glob}"
+ images_data = images_sigs.map do | sig |
file_path = sig.gsub SIGS_REGEX , '\1'
{
@@ -112,6 +113,8 @@ private
:size => (File.size "#{base_dir}/#{file_path}")
}
end
+
+ (images_data.empty?) ? [ {} ] : images_data
end
end