summaryrefslogtreecommitdiff
path: root/roundcubemail/tests
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-04-29 08:17:42 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-04-29 08:17:42 +0000
commitd196536731806de8edac56ff5695eb5cea5f671f (patch)
treee5806fbfb6e3948e30b2ba2127c61994f5ef550f /roundcubemail/tests
parent199c1ea8389abb003a8c663ca831ef8f269689a3 (diff)
- Fix relative URLs handling according to a <base> in HTML (#1487889)
git-svn-id: https://svn.roundcube.net/trunk@4710 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/tests')
-rw-r--r--roundcubemail/tests/mailfunc.php12
-rw-r--r--roundcubemail/tests/src/htmlbase.txt10
2 files changed, 22 insertions, 0 deletions
diff --git a/roundcubemail/tests/mailfunc.php b/roundcubemail/tests/mailfunc.php
index 92cfbb100..9d70befeb 100644
--- a/roundcubemail/tests/mailfunc.php
+++ b/roundcubemail/tests/mailfunc.php
@@ -145,4 +145,16 @@ class rcube_test_mailfunc extends UnitTestCase
$this->assertNoPattern('|<p>test2</p>|', $washed, "Conditional HTML comments");
}
+ /**
+ * Test URI base resolving in HTML messages
+ */
+ function test_resolve_base()
+ {
+ $html = file_get_contents(TESTS_DIR . 'src/htmlbase.txt');
+ $html = rcmail_resolve_base($html);
+
+ $this->assertPattern('|src="http://alec\.pl/dir/img1\.gif"|', $html, "URI base resolving [1]");
+ $this->assertPattern('|src="http://alec\.pl/dir/img2\.gif"|', $html, "URI base resolving [2]");
+ $this->assertPattern('|src="http://alec\.pl/img3\.gif"|', $html, "URI base resolving [3]");
+ }
}
diff --git a/roundcubemail/tests/src/htmlbase.txt b/roundcubemail/tests/src/htmlbase.txt
new file mode 100644
index 000000000..d1ddd5406
--- /dev/null
+++ b/roundcubemail/tests/src/htmlbase.txt
@@ -0,0 +1,10 @@
+<html>
+<head>
+<base href="http://alec.pl/dir/" />
+</head>
+<body>
+<img src="img1.gif" />
+<img src="./img2.gif" />
+<img src="../img3.gif" />
+</body>
+</html>