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
This commit is contained in:
Philipp Maier 2023-10-31 16:04:29 +01:00
parent 1da8636c0f
commit a24755e066
1 changed files with 1 additions and 2 deletions

View File

@ -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']: