From 61e3cfcac55193d9de4909b9d5dde4adcc1384d2 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 6 Oct 2022 00:10:52 +0200 Subject: [PATCH] Handle deleted files in CodeOcean::FilesController Fixes CODEOCEAN-E2 --- app/controllers/code_ocean/files_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/code_ocean/files_controller.rb b/app/controllers/code_ocean/files_controller.rb index 9ceed9cc..babe7cf6 100644 --- a/app/controllers/code_ocean/files_controller.rb +++ b/app/controllers/code_ocean/files_controller.rb @@ -11,6 +11,9 @@ module CodeOcean skip_before_action :verify_authenticity_token, only: :render_protected_upload before_action :require_user!, except: :render_protected_upload + # In case the .realpath cannot resolve a file (for example because it is no longer available) + rescue_from Errno::ENOENT, with: :render_not_found + def authorize! authorize(@file) end