Title: [230593] trunk/Tools
Revision
230593
Author
ross.kirsl...@sony.com
Date
2018-04-12 13:48:09 -0700 (Thu, 12 Apr 2018)

Log Message

pemfile.py should not assume POSIX line endings
https://bugs.webkit.org/show_bug.cgi?id=184507

Reviewed by Daniel Bates.

* Scripts/webkitpy/common/system/pemfile.py:
(_parse_pem_format):
* Scripts/webkitpy/common/system/pemfile_unittest.py:
(PemFileTest.test_parse_crlf):
(PemFileTest.test_parse_cr):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (230592 => 230593)


--- trunk/Tools/ChangeLog	2018-04-12 20:14:21 UTC (rev 230592)
+++ trunk/Tools/ChangeLog	2018-04-12 20:48:09 UTC (rev 230593)
@@ -1,3 +1,16 @@
+2018-04-12  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        pemfile.py should not assume POSIX line endings
+        https://bugs.webkit.org/show_bug.cgi?id=184507
+
+        Reviewed by Daniel Bates.
+
+        * Scripts/webkitpy/common/system/pemfile.py:
+        (_parse_pem_format):
+        * Scripts/webkitpy/common/system/pemfile_unittest.py:
+        (PemFileTest.test_parse_crlf):
+        (PemFileTest.test_parse_cr):
+
 2018-04-12  Zalan Bujtas  <za...@apple.com>
 
         [LayoutReloaded] Minor cleanup in LayoutSate

Modified: trunk/Tools/Scripts/webkitpy/common/system/pemfile.py (230592 => 230593)


--- trunk/Tools/Scripts/webkitpy/common/system/pemfile.py	2018-04-12 20:14:21 UTC (rev 230592)
+++ trunk/Tools/Scripts/webkitpy/common/system/pemfile.py	2018-04-12 20:48:09 UTC (rev 230593)
@@ -98,7 +98,7 @@
 
 
 def _parse_pem_format(content):
-    lines = content.split("\n")
+    lines = re.split('\r\n?|\n', content)
 
     def find_begin(lines):
         """

Modified: trunk/Tools/Scripts/webkitpy/common/system/pemfile_unittest.py (230592 => 230593)


--- trunk/Tools/Scripts/webkitpy/common/system/pemfile_unittest.py	2018-04-12 20:14:21 UTC (rev 230592)
+++ trunk/Tools/Scripts/webkitpy/common/system/pemfile_unittest.py	2018-04-12 20:48:09 UTC (rev 230593)
@@ -42,6 +42,18 @@
         with self.assertRaises(KeyError):
             pem.get("FOO BAR")
 
+    def test_parse_crlf(self):
+        pem = Pem(self.pem_contents.replace('\n', '\r\n'))
+
+        self.assertEqual(pem.private_key, self.private_key)
+        self.assertEqual(pem.certificate, self.certificate)
+
+    def test_parse_cr(self):
+        pem = Pem(self.pem_contents.replace('\n', '\r'))
+
+        self.assertEqual(pem.private_key, self.private_key)
+        self.assertEqual(pem.certificate, self.certificate)
+
     def test_parse_bad_format(self):
         with self.assertRaises(BadFormatError):
             # Partial contents raises format error
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to