From acf55a3b2742105af682999626dc733a110f5b86 Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Sun, 5 Mar 2023 19:07:36 +0200 Subject: normpath --- kvmd/fstab.py | 5 +++-- kvmd/plugins/msd/otg/drive.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kvmd/fstab.py b/kvmd/fstab.py index 20cd8101..0a4ee9a5 100644 --- a/kvmd/fstab.py +++ b/kvmd/fstab.py @@ -20,6 +20,7 @@ # ========================================================================== # +import os import re import dataclasses @@ -62,8 +63,8 @@ def _find_partitions(part_type: str, single: bool) -> list[Partition]: options = dict(re.findall(r"X-kvmd\.%s-(root|user)(?:=([^,]+))?" % (part_type), fields[3])) if options: parts.append(Partition( - mount_path=fields[1], - root_path=(options.get("root", "") or fields[1]), + mount_path=os.path.normpath(fields[1]), + root_path=os.path.normpath(options.get("root", "") or fields[1]), user=options.get("user", ""), )) if single: diff --git a/kvmd/plugins/msd/otg/drive.py b/kvmd/plugins/msd/otg/drive.py index 407aef9e..9fc947ab 100644 --- a/kvmd/plugins/msd/otg/drive.py +++ b/kvmd/plugins/msd/otg/drive.py @@ -57,7 +57,8 @@ class Drive: self.__set_param("forced_eject", "") def get_image_path(self) -> str: - return self.__get_param("file") + path = self.__get_param("file") + return (os.path.normpath(path) if path else "") def set_cdrom_flag(self, flag: bool) -> None: self.__set_param("cdrom", str(int(flag))) -- cgit v1.2.3