From 92c7469372aa8e9b42761a6b530280d415bc7629 Mon Sep 17 00:00:00 2001 From: Stas Date: Thu, 19 May 2016 18:06:27 +0300 Subject: [PATCH 1/2] 117690170-request_trim --- app/controllers/epp_controller.rb | 1 - lib/epp_constraint.rb | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index 3948a0645..de1002604 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -362,7 +362,6 @@ class EppController < ApplicationController frame.gsub!(/pw>.+<\//, 'pw>[FILTERED]]+)>([^<])+<\/eis:legalDocument>/, "[FILTERED]") if frame.present? - trimmed_request.gsub(/\s+\s+/, ">") ApiLog::EppLog.create({ request: trimmed_request, diff --git a/lib/epp_constraint.rb b/lib/epp_constraint.rb index 06cf3d45a..71c0e2fb2 100644 --- a/lib/epp_constraint.rb +++ b/lib/epp_constraint.rb @@ -11,6 +11,7 @@ class EppConstraint # creates parsed_frame, detects epp request object def matches?(request) # TODO: Maybe move this to controller to keep params clean + request.params[:raw_frame] = request.params[:raw_frame].gsub!(/\s<\//, "\s/, ">") request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame]) request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces! From 50fe0fa462921a788027ab5258c5c434d7d2ce28 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 20 May 2016 14:01:12 +0300 Subject: [PATCH 2/2] 117690107-trim_logic_change --- lib/epp_constraint.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/epp_constraint.rb b/lib/epp_constraint.rb index 71c0e2fb2..9cd68c121 100644 --- a/lib/epp_constraint.rb +++ b/lib/epp_constraint.rb @@ -11,7 +11,7 @@ class EppConstraint # creates parsed_frame, detects epp request object def matches?(request) # TODO: Maybe move this to controller to keep params clean - request.params[:raw_frame] = request.params[:raw_frame].gsub!(/\s<\//, "\s/, ">") + request.params[:raw_frame] = request.params[:raw_frame].gsub!(/(?<=>)(.*?)(?=<)/) { |s| s.strip} request.params[:nokogiri_frame] ||= Nokogiri::XML(request.params[:raw_frame]) request.params[:parsed_frame] ||= request.params[:nokogiri_frame].dup.remove_namespaces!