From db464d16f35b6179b83d08b269ae404e77ea5eb4 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 5 Jul 2017 11:49:43 +0800 Subject: [PATCH] small fix for index file check --- app/controllers/admin/hps_learnings_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/hps_learnings_controller.rb b/app/controllers/admin/hps_learnings_controller.rb index 2479afa..223dc7d 100644 --- a/app/controllers/admin/hps_learnings_controller.rb +++ b/app/controllers/admin/hps_learnings_controller.rb @@ -109,11 +109,14 @@ class Admin::HpsLearningsController < OrbitAdminController Zip::ZipFile.open(path) { |zip_file| zip_file.each { |f| f_path=File.join(destination, f.name) - zip_file.extract(f, f_path) unless File.exist?(f_path) files << f.name + zip_file.extract(f, f_path) unless File.exist?(f_path) } } - if files.include?("index.html") + foldername = File.basename(path).split(".") + foldername.pop + foldername = foldername.join(".") + if files.include?(foldername + "/index.html") render :json => {"success" => true}.to_json else render :json => {"success" => false, "msg" => "index.html file not present."}.to_json