diff --git a/app/models/share.rb b/app/models/share.rb index 322ebb13..4d3bc3b0 100644 --- a/app/models/share.rb +++ b/app/models/share.rb @@ -271,6 +271,7 @@ def before_save_hook return unless self.path_changed? return if self.path.nil? or self.path.blank? user = User.admins.first.login + system("mkdir -p \"#{self.path}\"") if Rails.env == 'development' c = Command.new c.submit("rmdir \"#{self.path_was}\"") unless self.path_was.blank? c.submit("mkdir -p \"#{self.path}\"") diff --git a/plugins/020-shares/app/controllers/shares_controller.rb b/plugins/020-shares/app/controllers/shares_controller.rb index 5e5063d8..6094a694 100644 --- a/plugins/020-shares/app/controllers/shares_controller.rb +++ b/plugins/020-shares/app/controllers/shares_controller.rb @@ -30,6 +30,7 @@ def index def create sleep 2 if development? @share = Share.new(params_create_share) + @share.path = "./.hda" + @share.path if development? @share.save get_shares unless @share.errors.any? end @@ -91,14 +92,14 @@ def toggle_guest_writeable render :json => { :status => @saved ? :ok : :not_acceptable } end - def update_tags + def update_tags sleep 2 if development? @saved = @share.update_tags!(params_update_tags_path) end def update_path sleep 2 if development? - @saved = @share.update_tags!(params_update_tags_path) + @saved = @share.update_tags!(params_update_tags_path) render :json => { :status => @saved ? :ok : :not_acceptable } end @@ -175,7 +176,7 @@ def params_update_tags_path unless params[:share].blank? params.require(:share).permit([:path,:tags]) else - params.permit([:name]) + params.permit([:name]) end end