mirror of
https://github.com/internetee/registry.git
synced 2025-06-14 16:44:46 +02:00
Change error type if legaldoc file is more than 8 MB
This commit is contained in:
parent
3b11f0bc20
commit
9f21b1704c
2 changed files with 14 additions and 9 deletions
|
@ -23,6 +23,8 @@ module Epp
|
|||
rescue_from ActiveRecord::RecordNotFound, with: :respond_with_object_does_not_exist_error
|
||||
before_action :set_paper_trail_whodunnit
|
||||
|
||||
EIGHT_MEGABYTES = 8_388_608
|
||||
|
||||
protected
|
||||
|
||||
def respond_with_command_failed_error(exception)
|
||||
|
@ -62,13 +64,17 @@ module Epp
|
|||
return if %w[hello error].include?(params[:action])
|
||||
schema.validate(params[:nokogiri_frame]).each do |error|
|
||||
epp_errors << {
|
||||
code: 2001,
|
||||
code: error_code(error),
|
||||
msg: error
|
||||
}
|
||||
end
|
||||
handle_errors and return if epp_errors.any?
|
||||
end
|
||||
|
||||
def error_code(error)
|
||||
error.str1.present? && error.str1.size > EIGHT_MEGABYTES ? 2306 : 2001
|
||||
end
|
||||
|
||||
def schema
|
||||
EPP_ALL_SCHEMA
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue