@@ -42,9 +42,11 @@ This file is part of the iText (R) project.
42
42
*/
43
43
package com .itextpdf .styledxmlparser .resolver .resource ;
44
44
45
+ import com .itextpdf .kernel .geom .PageSize ;
45
46
import com .itextpdf .test .ExtendedITextTest ;
46
47
import com .itextpdf .test .annotations .type .UnitTest ;
47
48
import org .junit .Assert ;
49
+ import org .junit .Ignore ;
48
50
import org .junit .Rule ;
49
51
import org .junit .Test ;
50
52
import org .junit .experimental .categories .Category ;
@@ -312,6 +314,50 @@ public void uriResolverTest18() {
312
314
Assert .assertFalse (resolver .isLocalBaseUri ());
313
315
}
314
316
317
+ @ Test
318
+ public void singleQuoteRelativePath () throws MalformedURLException {
319
+ String expectedUrl = "https://he.wikipedia.org/wiki/%D7%90%D7%91%D7%92'%D7%93" ;
320
+ String baseUri = "https://he.wikipedia.org/wiki/" ;
321
+ String relativePath = "%D7%90%D7%91%D7%92'%D7%93" ;
322
+ UriResolver resolver = new UriResolver (baseUri );
323
+
324
+ Assert .assertEquals (expectedUrl , resolver .resolveAgainstBaseUri (relativePath ).toExternalForm ());
325
+ }
326
+
327
+ @ Test
328
+ @ Ignore ("DEVSIX-2880: single quote character isn't encoded in Java and .NET 4.0, but it's encoded in .NETCoreApp 1.0" +
329
+ " from single quote to %27" )
330
+ public void quoteInPercentsRelativePath () throws MalformedURLException {
331
+ String expectedUrl = "https://he.wikipedia.org/wiki/%D7%90%D7%91%D7%92%27%D7%93" ;
332
+ String baseUri = "https://he.wikipedia.org/wiki/" ;
333
+ String relativePath = "%D7%90%D7%91%D7%92%27%D7%93" ;
334
+ UriResolver resolver = new UriResolver (baseUri );
335
+
336
+ Assert .assertEquals (expectedUrl , resolver .resolveAgainstBaseUri (relativePath ).toExternalForm ());
337
+ }
338
+
339
+ @ Test
340
+ public void singleQuoteBasePath () throws MalformedURLException {
341
+ String expectedUrl = "https://he.wikipedia.org/wiki'/%D7%90%D7%91%D7%92%D7%93" ;
342
+ String baseUri = "https://he.wikipedia.org/wiki'/" ;
343
+ String relativePath = "%D7%90%D7%91%D7%92%D7%93" ;
344
+ UriResolver resolver = new UriResolver (baseUri );
345
+
346
+ Assert .assertEquals (expectedUrl , resolver .resolveAgainstBaseUri (relativePath ).toExternalForm ());
347
+ }
348
+
349
+ @ Test
350
+ @ Ignore ("DEVSIX-2880: single quote character isn't encoded in Java and .NET 4.0, but it's encoded in .NETCoreApp 1.0" +
351
+ " from single quote to %27" )
352
+ public void quoteInPercentsBasePath () throws MalformedURLException {
353
+ String expectedUrl = "https://he.wikipedia.org/wiki%27/%D7%90%D7%91%D7%92%D7%93" ;
354
+ String baseUri = "https://he.wikipedia.org/wiki%27/" ;
355
+ String relativePath = "%D7%90%D7%91%D7%92%D7%93" ;
356
+ UriResolver resolver = new UriResolver (baseUri );
357
+
358
+ Assert .assertEquals (expectedUrl , resolver .resolveAgainstBaseUri (relativePath ).toExternalForm ());
359
+ }
360
+
315
361
private void testPaths (UriResolver resolver , String path ) throws MalformedURLException {
316
362
Assert .assertEquals (path + "test/folder/index.html" , resolver .getBaseUri ());
317
363
Assert .assertEquals (path + "test/folder/innerTest" , resolver .resolveAgainstBaseUri ("innerTest" ).toExternalForm ());
0 commit comments