Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
41eb313e
Commit
41eb313e
authored
Feb 09, 2014
by
Artem Mezhenin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update regex for matching URLs, fixes issue #1386
parent
b0460a4a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
rest_framework/templatetags/rest_framework.py
+2
-3
No files found.
rest_framework/templatetags/rest_framework.py
View file @
41eb313e
...
...
@@ -6,7 +6,7 @@ from django.utils.encoding import iri_to_uri
from
django.utils.html
import
escape
from
django.utils.safestring
import
SafeData
,
mark_safe
from
rest_framework.compat
import
urlparse
,
force_text
,
six
,
smart_urlquote
import
re
,
string
import
re
register
=
template
.
Library
()
...
...
@@ -185,7 +185,7 @@ WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('[', ']'), ('<', '>'),
(
'"'
,
'"'
),
(
"'"
,
"'"
)]
word_split_re
=
re
.
compile
(
r'(\s+)'
)
simple_url_re
=
re
.
compile
(
r'^https?://\[?\w'
,
re
.
IGNORECASE
)
simple_url_2_re
=
re
.
compile
(
r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)$'
,
re
.
IGNORECASE
)
simple_url_2_re
=
re
.
compile
(
r'^www\.|^(?!http)\w[^@
\[\]
]+\.(com|edu|gov|int|mil|net|org)$'
,
re
.
IGNORECASE
)
simple_email_re
=
re
.
compile
(
r'^\S+@\S+\.\S+$'
)
...
...
@@ -211,7 +211,6 @@ def urlize_quoted_links(text, trim_url_limit=None, nofollow=True, autoescape=Tru
safe_input
=
isinstance
(
text
,
SafeData
)
words
=
word_split_re
.
split
(
force_text
(
text
))
for
i
,
word
in
enumerate
(
words
):
match
=
None
if
'.'
in
word
or
'@'
in
word
or
':'
in
word
:
# Deal with punctuation.
lead
,
middle
,
trail
=
''
,
word
,
''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment