better card decline copy - catch renames with too long filenames/paths

This commit is contained in:
Kyle Drake 2024-02-03 13:05:50 -06:00
parent 623dfd05fc
commit 682f450561
2 changed files with 9 additions and 1 deletions

View file

@ -55,7 +55,7 @@ post '/supporter/update' do
plan: plan_type
)
rescue Stripe::CardError => e
flash[:error] = "Error: #{Rack::Utils.escape_html e.message}"
flash[:error] = "Error: #{Rack::Utils.escape_html e.message} This is likely caused by incorrect information, or an issue with your credit card. Please try again, or contact your bank."
redirect '/supporter'
end

View file

@ -58,6 +58,14 @@ class SiteFile < Sequel::Model
current_path = self.path
new_path = site.scrubbed_path new_path
if new_path.length > FILE_PATH_CHARACTER_LIMIT
return false, 'new path too long'
end
if File.basename(new_path).length > FILE_NAME_CHARACTER_LIMIT
return false, 'new filename too long'
end
if new_path == ''
return false, 'cannot rename to empty path'
end