laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/35730?usp=email )
Change subject: saip.personalization: Fix ICCID fillFileContent replacement ......................................................................
saip.personalization: Fix ICCID fillFileContent replacement
Change-Id: Ic267fdde3b648b376ea6814783df1e90ea9bb9ad --- M pySim/esim/saip/personalization.py 1 file changed, 13 insertions(+), 3 deletions(-)
Approvals: laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py index bde7ce6..cb3edc1 100644 --- a/pySim/esim/saip/personalization.py +++ b/pySim/esim/saip/personalization.py @@ -26,7 +26,8 @@
def file_replace_content(file: List[Tuple], new_content: bytes): """Completely replace all fillFileContent of a decoded 'File' with the new_content.""" - file = remove_unwanted_tuples_from_list(file, ['fillFileContent', 'fillFileOffset']) + # use [:] to avoid making a copy, as we're doing in-place modification of the list here + file[:] = remove_unwanted_tuples_from_list(file, ['fillFileContent', 'fillFileOffset']) file.append(('fillFileContent', new_content)) return file
@@ -54,9 +55,9 @@ name = 'iccid' def apply(self, pes: ProfileElementSequence): # patch the header; FIXME: swap nibbles! - pes.get_pe_by_type('header').decoded['iccid'] = self.value + pes.get_pe_for_type('header').decoded['iccid'] = self.value # patch MF/EF.ICCID - file_replace_content(pes.get_pe_by_type('mf').decoded['ef-iccid'], self.value) + file_replace_content(pes.get_pe_for_type('mf').decoded['ef-iccid'], bytes(self.value))
class Imsi(ConfigurableParameter): """Configurable IMSI. Expects value to be n EF.IMSI format."""