diff --git a/app/controllers/admin/patchfiles_controller.rb b/app/controllers/admin/patchfiles_controller.rb index cebe1e6..c847a44 100644 --- a/app/controllers/admin/patchfiles_controller.rb +++ b/app/controllers/admin/patchfiles_controller.rb @@ -112,8 +112,8 @@ class Admin::PatchfilesController < OrbitAdminController @file = params["fontfile"]["font_file"] if params["fontfile"]["font_file"] != "" @file_path = Rails.root.to_s + '/app/assets/fonts' - if @file.nil? != true - @file_name = @file.original_filename + if !@file.nil? + @file_name = File.basename(@file.original_filename) @file_content = @file.read @file_content.force_encoding('UTF-8') File.open("#{@file_path}/#{@file_name}","w+") do |f| diff --git a/updatefiles/application_helper.rb b/updatefiles/application_helper.rb index 0c3593b..4318966 100644 --- a/updatefiles/application_helper.rb +++ b/updatefiles/application_helper.rb @@ -707,8 +707,8 @@ module ApplicationHelper plugin = OrbitApp::Plugin::Registration.find_by_module_app_name(page.module.classify) || OrbitApp::Plugin::Registration.find_by_module_app_name(page.module) override_data = {'widget-title'=>plugin.name} end - filename = overridehtml.nil? ? params[:layout_type].to_s.split('/').last : overridehtml - module_name = params[:target_controller].to_s.split('/').last.singularize + filename = overridehtml.nil? ? File.basename(params[:layout_type]) : overridehtml + module_name = File.basename(params[:target_controller]).singularize f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', module_name, "#{filename}.html.erb") if !File.exists?f f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', module_name, "index.html.erb") @@ -768,8 +768,8 @@ module ApplicationHelper return "