From a24755e066021905268d4b9a9bc6e7406b3464d2 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Tue, 31 Oct 2023 16:04:29 +0100 Subject: [PATCH] filesystem: fix method build_select_path_to The method build_select_path_to chops off the first element of the current path. This is done to prevent re-selection of the first file in the current path. Unfortunately chopping off the first element in the current path does not work properly in a situation when the current path points to the MF. This would chop off the first and last element in the list and the for loop below would run 0 times. To fix this, let's keep the first element and chop it off from the resulting path. Related: OS#5418 Change-Id: Ia521a7ac4c25fd3a2bc8edffdc45ec89ba4b16eb --- pySim/filesystem.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pySim/filesystem.py b/pySim/filesystem.py index 5950ad14..800f2cc8 100644 --- a/pySim/filesystem.py +++ b/pySim/filesystem.py @@ -143,7 +143,6 @@ class CardFile: cur_fqpath = self.fully_qualified_path_fobj() target_fqpath = target.fully_qualified_path_fobj() inter_path = [] - cur_fqpath.pop() # drop last element (currently selected file, doesn't need re-selection cur_fqpath.reverse() for ce in cur_fqpath: inter_path.append(ce) @@ -153,7 +152,7 @@ class CardFile: for te2 in target_fqpath[i+1:]: inter_path.append(te2) # we found our common ancestor - return inter_path + return inter_path[1:] return None def get_mf(self) -> Optional['CardMF']: