Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion precise_bbcode/bbcode/defaults/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Options:

def render(self, value, option=None, parent=None):
href = option if option else value
if href[0] == href[-1] and href[0] in ('"', '\'') and len(href) > 2:
if len(href) > 2 and href[0] == href[-1] and href[0] in ('"', '\''):
# URLs can be encapsulated in quotes (either single or double) that aren't part of the
# URL. If that's the case, strip them out.
href = href[1:-1]
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ class TestParser(object):
('[color=some words]test[/color]', '[color=some words]test[/color]'),
# Unknown BBCodes
('[unknown][hello][/unknown]', '[unknown][hello][/unknown]'),
('[url]"[url]', '[url]"[url]'),
('[url="]wow, that is very short[url]', '[url="]wow, that is very short[url]'),
)

CUSTOM_TAGS_RENDERING_TESTS = {
Expand Down