Enrique Sánchez has proposed merging
~enriqueesanchz/launchpad:add-uct-import-handler into launchpad:master.
Commit message:
Fix UCTRecord.from_str
When getting a file from a git repository using the getBlob() we are
getting a byte string.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~enriqueesanchz/launchpad/+git/launchpad/+merge/493314
--
Your team Launchpad code reviewers is requested to review the proposed merge of
~enriqueesanchz/launchpad:add-uct-import-handler into launchpad:master.
diff --git a/lib/lp/bugs/scripts/tests/test_uct.py b/lib/lp/bugs/scripts/tests/test_uct.py
index 9b5767e..7b022c0 100644
--- a/lib/lp/bugs/scripts/tests/test_uct.py
+++ b/lib/lp/bugs/scripts/tests/test_uct.py
@@ -269,7 +269,7 @@ class TestUCTRecord(TestCase):
def test_from_str(self):
load_from = Path(__file__).parent / "sampledata" / "CVE-2022-23222"
- with open(load_from) as f:
+ with open(load_from, "rb") as f:
string = f.read()
record = UCTRecord.from_str(string)
diff --git a/lib/lp/bugs/scripts/uct/models.py b/lib/lp/bugs/scripts/uct/models.py
index 6aa6013..e707b49 100644
--- a/lib/lp/bugs/scripts/uct/models.py
+++ b/lib/lp/bugs/scripts/uct/models.py
@@ -151,7 +151,7 @@ class UCTRecord(SVTRecord):
@classmethod
def from_str(self, string: str) -> "UCTRecord":
- with tempfile.NamedTemporaryFile("w") as fp:
+ with tempfile.NamedTemporaryFile("wb") as fp:
fp.write(string)
fp.flush()
return self.load(Path(fp.name))
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp