mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
graceful fail for missing file to edit
This commit is contained in:
parent
7f4cc8e5df
commit
6c9d387a4c
1 changed files with 6 additions and 1 deletions
7
app.rb
7
app.rb
|
@ -320,7 +320,12 @@ end
|
|||
|
||||
get '/site_files/text_editor/:filename' do |filename|
|
||||
require_login
|
||||
@file_data = File.read File.join(site_base_path(current_site.username), filename)
|
||||
begin
|
||||
@file_data = File.read File.join(site_base_path(current_site.username), filename)
|
||||
rescue Errno::ENOENT
|
||||
flash[:error] = 'We could not find the requested file.'
|
||||
redirect '/dashboard'
|
||||
end
|
||||
slim :'site_files/text_editor'
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue