mirror of
https://github.com/neocities/neocities.git
synced 2025-06-19 19:00:34 +02:00
improve file type message, fix missing directory for drag-n-drop
This commit is contained in:
parent
7dc4179bf8
commit
d2e2dd3482
2 changed files with 8 additions and 13 deletions
|
@ -39,16 +39,11 @@ end
|
|||
|
||||
def file_upload_response(error=nil)
|
||||
http_error_code = 406
|
||||
flash[:error] = error if error
|
||||
|
||||
if params[:from_button]
|
||||
if error
|
||||
@error = error
|
||||
dashboard_init
|
||||
halt 200, erb(:'dashboard')
|
||||
else
|
||||
query_string = params[:dir] ? "?"+Rack::Utils.build_query(dir: params[:dir]) : ''
|
||||
redirect "/dashboard#{query_string}"
|
||||
end
|
||||
query_string = params[:dir] ? "?"+Rack::Utils.build_query(dir: params[:dir]) : ''
|
||||
redirect "/dashboard#{query_string}"
|
||||
else
|
||||
halt http_error_code, error if error
|
||||
halt 200, 'File(s) successfully uploaded.'
|
||||
|
@ -67,12 +62,10 @@ post '/site_files/upload' do
|
|||
params[:files].each do |file|
|
||||
file[:filename] = "#{params[:dir]}/#{file[:filename]}" if params[:dir]
|
||||
if current_site.file_size_too_large? file[:tempfile].size
|
||||
file_upload_response "#{params[:dir]}/#{file[:filename]} is too large, upload cancelled."
|
||||
file_upload_response "#{file[:filename]} is too large, upload cancelled."
|
||||
end
|
||||
if !current_site.okay_to_upload? file
|
||||
file_upload_response %{#{params[:dir]}#{file[:filename]}: file type (or content in file) is only supported by supporter accounts.}
|
||||
# TODO: Better explanation and link.
|
||||
#<a href="/plan">supporter accounts</a>. <a href="/site_files/allowed_types">Why We Do This</a>}
|
||||
file_upload_response %{#{file[:filename]}: file type (or content in file) is only supported by <a href="/plan">supporter accounts</a>. <a href="/site_files/allowed_types">Why We Do This</a>}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue