From 5f2025051d37f923b5be02372666d61709de22cb Mon Sep 17 00:00:00 2001 From: Mischa Berger Date: Sun, 25 Jun 2017 01:56:07 +0900 Subject: [PATCH] Patches for clipboard_controller and files_controller --- patches/clipboard_controller.patch | 13 +++++++++++++ patches/files_controller.patch | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 patches/clipboard_controller.patch create mode 100644 patches/files_controller.patch diff --git a/patches/clipboard_controller.patch b/patches/clipboard_controller.patch new file mode 100644 index 0000000..1defcbb --- /dev/null +++ b/patches/clipboard_controller.patch @@ -0,0 +1,13 @@ +diff --git a/app/controllers/clipboard_controller.rb b/app/controllers/clipboard_controller.rb +index 0eff17b..1c8183b 100644 +--- a/app/controllers/clipboard_controller.rb ++++ b/app/controllers/clipboard_controller.rb +@@ -3,7 +3,7 @@ class ClipboardController < ApplicationController + before_action :require_existing_target_folder, :only => [:copy, :move] + before_action :require_target_is_not_child, :only => :move + before_action :require_create_permission, :only => [:copy, :move] +- before_action :require_read_permission, :only => :create ++ before_action :require_read_permission, :only => [:create, :copy, :move] + before_action :require_delete_permission, :only => :move + + # @item is set in require_existing_item diff --git a/patches/files_controller.patch b/patches/files_controller.patch new file mode 100644 index 0000000..181c188 --- /dev/null +++ b/patches/files_controller.patch @@ -0,0 +1,20 @@ +diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb +index 9f9cd8a..22b3a5e 100644 +--- a/app/controllers/files_controller.rb ++++ b/app/controllers/files_controller.rb +@@ -43,9 +43,12 @@ class FilesController < ApplicationController + end + + def exists +- @file = UserFile.new(:attachment_file_name => params[:name].gsub(RESTRICTED_CHARACTERS, '_')) +- @file.folder_id = params[:folder] +- render :json => !@file.valid? ++ @folder = Folder.find(params[:folder]) ++ ++ if current_user.can_read @folder || current_user.can_write @folder ++ @file = @folder.user_files.build(:attachment_file_name => params[:name].gsub(RESTRICTED_CHARACTERS, '_')) ++ render :json => !@file.valid? ++ end + end + + private