Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe357c0a authored by Alexander Grund's avatar Alexander Grund Committed by Jan Altensen
Browse files

Use a RegEx to get carrier instead of XML parsing

As we later do literal matches against the lines XML parsing is the
wrong approach as e.g. XML excapes will not be found which causes custom
APNs with e.g. `&` to be ignored, i.e. they will not overwrite the
default ones and will be fully missing from the output file.

Change-Id: I2bc575d4bbdc5d802c5d5b3420ee6b536a5a18fc
parent 711b7bf5
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -15,8 +15,8 @@
# limitations under the License.
# limitations under the License.
#
#


import re
import sys
import sys
from xml.dom.minidom import parseString


def main(argv):
def main(argv):
    reload(sys)
    reload(sys)
@@ -32,9 +32,7 @@ def main(argv):
    custom_apn_names = set()
    custom_apn_names = set()
    with open(custom_override_file, 'r') as f:
    with open(custom_override_file, 'r') as f:
        for line in f:
        for line in f:
            xmltree = parseString(line)
            custom_apn_names.add(re.search(r'carrier="[^"]+"', line).group(0))
            carrier = xmltree.getElementsByTagName('apn')[0].getAttribute('carrier')
            custom_apn_names.add('carrier="' + carrier + '"')


    with open(original_file, 'r') as input_file:
    with open(original_file, 'r') as input_file:
        with open(output_file_path, 'w') as output_file:
        with open(output_file_path, 'w') as output_file: