Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
c43c469a
Kaydet (Commit)
c43c469a
authored
Ock 04, 2014
tarafından
Vajrasky Kok
Kaydeden (comit)
Tim Graham
Şub 06, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #21731 -- Made javascript_quote escapes '</'.
üst
b17c7556
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
text.py
django/utils/text.py
+1
-0
test_text.py
tests/utils_tests/test_text.py
+11
-0
No files found.
django/utils/text.py
Dosyayı görüntüle @
c43c469a
...
...
@@ -327,6 +327,7 @@ def javascript_quote(s, quote_double_quotes=False):
s
=
s
.
replace
(
'
\n
'
,
'
\\
n'
)
s
=
s
.
replace
(
'
\t
'
,
'
\\
t'
)
s
=
s
.
replace
(
"'"
,
"
\\
'"
)
s
=
s
.
replace
(
'</'
,
'<
\\
/'
)
if
quote_double_quotes
:
s
=
s
.
replace
(
'"'
,
'"'
)
return
str
(
ustring_re
.
sub
(
fix
,
s
))
...
...
tests/utils_tests/test_text.py
Dosyayı görüntüle @
c43c469a
...
...
@@ -144,3 +144,14 @@ class TestUtilsText(SimpleTestCase):
def
test_get_valid_filename
(
self
):
filename
=
"^&'@{}[],$=!-#()
%+
~_123.txt"
self
.
assertEqual
(
text
.
get_valid_filename
(
filename
),
"-_123.txt"
)
def
test_javascript_quote
(
self
):
input
=
"<script>alert('Hello
\\
xff.
\n
Welcome
\t
here
\r
');</script>"
output
=
r"<script>alert(\'Hello \\xff.\n Welcome\there\r\');<\/script>"
self
.
assertEqual
(
text
.
javascript_quote
(
input
),
output
)
# Exercising quote_double_quotes keyword argument
input
=
'"Text"'
self
.
assertEqual
(
text
.
javascript_quote
(
input
),
'"Text"'
)
self
.
assertEqual
(
text
.
javascript_quote
(
input
,
quote_double_quotes
=
True
),
'"Text"'
)
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