mirror of
https://github.com/neocities/neocities.git
synced 2025-07-20 09:36:00 +02:00
fixes for upload hash check, catch index.html delete scenario
This commit is contained in:
parent
61bf9012d6
commit
bf089379aa
2 changed files with 4 additions and 24 deletions
12
app/api.rb
12
app/api.rb
|
@ -7,17 +7,11 @@ end
|
|||
|
||||
post '/api/upload_hash' do
|
||||
require_api_credentials
|
||||
|
||||
res = {}
|
||||
|
||||
if params[:files].blank? || !params[:files].is_a?(Hash)
|
||||
api_error 400, 'no_file_hashes_provided', 'no file hashes provided'
|
||||
end
|
||||
|
||||
params[:files].each do |k,v|
|
||||
files = []
|
||||
params.each do |k,v|
|
||||
res[k] = current_site.sha1_hash_match? k, v
|
||||
end
|
||||
|
||||
api_success files: res
|
||||
end
|
||||
|
||||
|
@ -101,7 +95,7 @@ post '/api/delete' do
|
|||
api_error 400, 'missing_files', "#{path} was not found on your site, canceled deleting"
|
||||
end
|
||||
|
||||
if path == 'index.html'
|
||||
if path == 'index.html' || path == '/index.html'
|
||||
api_error 400, 'cannot_delete_index', 'you cannot delete your index.html file, canceled deleting'
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue