File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Doppler.HtmlEditorApi.Test/Domain
Doppler.HtmlEditorApi/Domain Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -307,6 +307,22 @@ public void GetTrackableUrls_should_not_map_field_names()
307307 link => Assert . Equal ( "ftp://|*|3*|*" , link ) ) ;
308308 }
309309
310+ [ Fact ]
311+ public void GetTrackableUrls_remove_encoding_on_sanitize_to_save ( )
312+ {
313+ // Arrange
314+ var input = "<p><a href=\" https://midomain.com/?param1=aa&param2=bb\" >This is a link with parameters</a></p>" ;
315+ var htmlDocument = new DopplerHtmlDocument ( input ) ;
316+ htmlDocument . GetDopplerContent ( ) ;
317+ htmlDocument . SanitizeTrackableLinks ( ) ;
318+
319+ // Act
320+ var links = htmlDocument . GetTrackableUrls ( ) ;
321+
322+ // Assert
323+ Assert . Equal ( "https://midomain.com/?param1=aa¶m2=bb" , links . FirstOrDefault ( ) ) ;
324+ }
325+
310326 [ Theory ]
311327 [ InlineDataAttribute (
312328 @"
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ private static string SanitizedUrl(string url)
151151 var domain = match . Groups [ "domain" ] . Value
152152 . FallbackIfNullOrEmpty ( match . Groups [ "domainWithoutScheme" ] . Value )
153153 . ToLowerInvariant ( ) ;
154- var rest = match . Groups [ "rest" ] . Value ;
154+ var rest = match . Groups [ "rest" ] . Value . Replace ( "&" , "&" ) ;
155155 var sanitizedUrl = $ "{ scheme } { domain } { rest } ";
156156
157157 return sanitizedUrl ;
You can’t perform that action at this time.
0 commit comments