diff --git a/helpdesk/templatetags/ticket_to_link.py b/helpdesk/templatetags/ticket_to_link.py
index 1280f846..6cc4023d 100644
--- a/helpdesk/templatetags/ticket_to_link.py
+++ b/helpdesk/templatetags/ticket_to_link.py
@@ -39,7 +39,7 @@ def num_to_link(text):
if ticket:
style = ticket.get_status_display()
text = "%s #%s%s" % (
- text[:match.start()], url, style, match.groups()[0], text[match.end():])
+ text[:match.start()+1], url, style, match.groups()[0], text[match.end():])
return mark_safe(text)
register = template.Library()
diff --git a/helpdesk/tests/test_ticket_actions.py b/helpdesk/tests/test_ticket_actions.py
index 7f9e23b5..ca183c1d 100644
--- a/helpdesk/tests/test_ticket_actions.py
+++ b/helpdesk/tests/test_ticket_actions.py
@@ -125,6 +125,7 @@ class TicketActionsTestCase(TestCase):
def test_num_to_link(self):
"""Test that we are correctly expanding links to tickets from IDs"""
+
# make staff user
self.loginUser()
@@ -141,7 +142,10 @@ class TicketActionsTestCase(TestCase):
# generate the URL text
result = num_to_link('this is ticket#%s' % ticket_id)
- self.assertEqual(result, "this is ticke #%s" % (ticket_id, ticket_id))
+ self.assertEqual(result, "this is ticket #%s" % (ticket_id, ticket_id))
+
+ result2 = num_to_link('whoa another ticket is here #%s huh' % ticket_id)
+ self.assertEqual(result2, "whoa another ticket is here #%s huh" % (ticket_id, ticket_id))
def test_create_ticket_getform(self):
self.loginUser()