mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +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|
|
get '/site_files/text_editor/:filename' do |filename|
|
||||||
require_login
|
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'
|
slim :'site_files/text_editor'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue