From: Andreas Bauer
---
src/webui/app/controllers/package_controller.rb | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/webui/app/controllers/package_controller.rb b/src/webui/app/controllers/package_controller.rb
index 36f5763..f634c6d 100644
--- a/src/webui/app/controllers/package_controller.rb
+++ b/src/webui/app/controllers/package_controller.rb
@@ -107,11 +107,18 @@ class PackageController < ApplicationController
end
filetype = params[:filetype]
+ if @package.file("@filename='#{filename}'")
+ @package.remove_file filename
+ flash_message = "File '#{filename}' replaced successfully"
+ else
+ flash_message = "File '#{filename}' added successfully"
+ end
+
logger.debug "controller: starting to add file: #{filename}"
@package.add_file :file => file, :filename => filename, :filetype => filetype
if @package.save_files and @package.save
- flash[:note] = "File '#{filename}' added successfully"
+ flash[:note] = flash_message
else
flash[:note] = "Failed to add file '#{filename}'"
end
--
1.7.7
--
To unsubscribe, e-mail: obs-commits+unsubscribe@opensuse.org
To contact the owner, e-mail: obs-commits+owner@opensuse.org