From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=770903
---
src/app/controllers/images_controller.rb | 6 ++++++
src/config/locales/en.yml | 3 +++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/app/controllers/images_controller.rb
b/src/app/controllers/images_controller.rb
index 018929c..f5a0791 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -92,6 +92,12 @@ class ImagesController < ApplicationController
end
def import
+ if params[:image_id].blank? || params[:name].blank?
+ flash[:warning] = t('images.import.flash.warning.name_or_image_id_blank')
+ redirect_to new_image_url(:tab => 'import')
+ return
+ end
+
account = ProviderAccount.find(params[:provider_account])
xml =
"<image><name>#{params[:name]}</name></image>" unless
params[:name].blank?
begin
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 4be4510..7e149d3 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -691,6 +691,9 @@ en:
name: Image Name
image_imported: The image was imported successfully.
image_not_imported: The image could not be imported. Check the Image Factory log
for further details.
+ flash:
+ warning:
+ name_or_image_id_blank: 'Image ID and Image Name cannot be blank!'
index:
images: Images
name: Name
--
1.7.6.4