laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/35729?usp=email )


Change subject: saip.personalization: Also drop any fillFileOffset
......................................................................

saip.personalization: Also drop any fillFileOffset

When replacing a file's contents, we must not just remove any
fillFileContent tuples, but also the fillFileOffset.

Change-Id: I3e4d97ae9de8a78f7bc0165ece5954481568b800
---
M pySim/esim/saip/personalization.py
1 file changed, 15 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/29/35729/1

diff --git a/pySim/esim/saip/personalization.py 
b/pySim/esim/saip/personalization.py
index 32a53e6..bde7ce6 100644
--- a/pySim/esim/saip/personalization.py
+++ b/pySim/esim/saip/personalization.py
@@ -20,13 +20,13 @@

 from pySim.esim.saip import ProfileElement, ProfileElementSequence

-def remove_unwanted_tuples_from_list(l: List[Tuple], unwanted_key:str) -> 
List[Tuple]:
+def remove_unwanted_tuples_from_list(l: List[Tuple], unwanted_keys: List[str]) 
-> List[Tuple]:
     """In a list of tuples, remove all tuples whose first part equals 
'unwanted_key'."""
-    return list(filter(lambda x: x[0] != unwanted_key, l))
+    return list(filter(lambda x: x[0] not in unwanted_keys, l))

 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')
+    file = remove_unwanted_tuples_from_list(file, ['fillFileContent', 
'fillFileOffset'])
     file.append(('fillFileContent', new_content))
     return file


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35729?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I3e4d97ae9de8a78f7bc0165ece5954481568b800
Gerrit-Change-Number: 35729
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>
Gerrit-MessageType: newchange

Reply via email to