diff --git a/ext/tag_edit/test.php b/ext/tag_edit/test.php
index 44eb1e2f..37fe714e 100644
--- a/ext/tag_edit/test.php
+++ b/ext/tag_edit/test.php
@@ -30,13 +30,13 @@ class TagEditTest extends ShimmieWebTestCase {
$this->set_field("tag_edit__source", "example.com");
$this->click("Set");
- $this->click("source");
+ $this->click("example.com");
$this->assert_title("Example Web Page");
$this->back();
$this->set_field("tag_edit__source", "http://example.com");
$this->click("Set");
- $this->click("source");
+ $this->click("example.com");
$this->assert_title("Example Web Page");
$this->back();
diff --git a/ext/tag_edit/theme.php b/ext/tag_edit/theme.php
index 419afee6..5ad429e4 100644
--- a/ext/tag_edit/theme.php
+++ b/ext/tag_edit/theme.php
@@ -66,13 +66,13 @@ class TagEditTheme extends Themelet {
private function format_source(/*string*/ $source) {
if(!empty($source)) {
- $h_source = html_escape($source);
- if(startsWith($source, "http://") || startsWith($source, "https://")) {
- return "$h_source";
- }
- else {
- return "$h_source";
+ if(!startsWith($source, "http://") && !startsWith($source, "https://")) {
+ $source = "http://" . $source;
}
+ $proto_domain = explode("://", $source);
+ $h_source = html_escape($proto_domain[1]);
+ $u_source = html_escape($source);
+ return "$h_source";
}
return "Unknown";
}