From c3e52b08df3aa53284c2237c5656819c0583897c Mon Sep 17 00:00:00 2001 From: BOHUNG Date: Sun, 29 Sep 2019 16:13:18 +0800 Subject: [PATCH] add some rescue --- app/controllers/admin/patchfiles_controller.rb | 3 ++- app/models/patchfilefield.rb | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/patchfiles_controller.rb b/app/controllers/admin/patchfiles_controller.rb index 235da5e..61ebfaa 100644 --- a/app/controllers/admin/patchfiles_controller.rb +++ b/app/controllers/admin/patchfiles_controller.rb @@ -127,8 +127,9 @@ class Admin::PatchfilesController < OrbitAdminController end end def getfont + @font_array = [] @ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor' - @filedata = File.read(@ckeditor_path+"/config.js.erb") + @filedata = File.read(@ckeditor_path+"/config.js.erb") rescue return @name_to_search ="config.font_names" @index_of_font = @filedata.index(@name_to_search) @font_str = "" diff --git a/app/models/patchfilefield.rb b/app/models/patchfilefield.rb index 79c8429..d920591 100644 --- a/app/models/patchfilefield.rb +++ b/app/models/patchfilefield.rb @@ -32,7 +32,7 @@ class Patchfilefield end def get_font_to_store @ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor' - @filedata = File.read(@ckeditor_path+"/config.js.erb") + @filedata = File.read(@ckeditor_path+"/config.js.erb") rescue return @name_to_search ="config.font_names" @index_of_font = @filedata.index(@name_to_search) @font_str = "" @@ -119,7 +119,7 @@ class Patchfilefield end def check_font_state @ckeditor_path = ENV['PWD'] + '/app/assets/javascripts/ckeditor' - @filedata = File.read(@ckeditor_path+"/config.js.erb") + @filedata = File.read(@ckeditor_path+"/config.js.erb") rescue return @name_to_search ="config.font_names" @index_of_font = @filedata.index(@name_to_search) @font_str = "" @@ -221,7 +221,7 @@ class Patchfilefield puts @filedata @filetowrite.write(@filedata) @filetowrite.close - @filetocover = File.open("config.js.erb","w") + @filetocover = File.open("config.js.erb","w") rescue return @filetocover.write(@filedata) @filetocover.close File.delete("config_back.js.erb")