pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/3e2ea79bdaa6be1337b34f8da03f8c42dfe43d2f

Fixing the issue4860. Escaping the embedded '"' in the js_output meth… · python/cpython@3e2ea79 · GitHub
Skip to content

Commit 3e2ea79

Browse files
committed
Fixing the issue4860. Escaping the embedded '"' in the js_output method of Morsel class.
1 parent b868a66 commit 3e2ea79

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

Lib/http/cookies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def js_output(self, attrs=None):
392392
document.cookie = \"%s\";
393393
// end hiding -->
394394
</script>
395-
""" % ( self.OutputString(attrs), )
395+
""" % ( self.OutputString(attrs).replace('"',r'\"'))
396396
# end js_output()
397397

398398
def OutputString(self, attrs=None):

Lib/test/test_http_cookies.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ def test_load(self):
5050

5151
self.assertEqual(C.output(['path']),
5252
'Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme')
53-
self.assertEqual(C.js_output(), """
53+
self.assertEqual(C.js_output(), r"""
5454
<script type="text/javascript">
5555
<!-- begin hiding
56-
document.cookie = "Customer="WILE_E_COYOTE"; Path=/acme; Version=1";
56+
document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme; Version=1";
5757
// end hiding -->
5858
</script>
5959
""")
60-
self.assertEqual(C.js_output(['path']), """
60+
self.assertEqual(C.js_output(['path']), r"""
6161
<script type="text/javascript">
6262
<!-- begin hiding
63-
document.cookie = "Customer="WILE_E_COYOTE"; Path=/acme";
63+
document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme";
6464
// end hiding -->
6565
</script>
6666
""")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy