fix(custom-client): validate portable exclusion and MSI action data

Fail when --exclude-exe does not match a file, and propagate MSI
CustomActionData read failures while preserving legacy fallback behavior.

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2026-08-17 18:08:19 +08:00
parent a9a071d6bc
commit 48cba01f68
2 changed files with 7 additions and 1 deletions
+4
View File
@@ -25,6 +25,7 @@ def normalize(path: str) -> str:
def generate_md5_table(folder: str, level, exclude: str = None) -> dict:
res: dict = dict()
skip = normalize(exclude) if exclude else None
excluded = False
# os.curdir is the literal ".", so restoring it left us inside `folder`.
curdir = os.getcwd()
os.chdir(folder)
@@ -35,6 +36,7 @@ def generate_md5_table(folder: str, level, exclude: str = None) -> dict:
full_path = os.path.join(root, f)
if skip and normalize(full_path) == skip:
print(f"Excluding {full_path}...")
excluded = True
continue
print(f"Processing {full_path}...")
f = open(full_path, "rb")
@@ -45,6 +47,8 @@ def generate_md5_table(folder: str, level, exclude: str = None) -> dict:
md5_code = md5_generator.hexdigest().encode(encoding=encoding)
res[full_path] = (content_compressed, md5_code)
os.chdir(curdir)
if skip and not excluded:
raise ValueError(f"excluded file was not found in {folder}: {exclude}")
return res
+3 -1
View File
@@ -1077,7 +1077,9 @@ UINT __stdcall UninstallPrinter(
// Must match the name install used, otherwise the printer is left behind. Absent
// on packages built before this was passed in, where it was the stock name.
if (SUCCEEDED(WcaGetProperty(L"CustomActionData", &pwzData)) && pwzData)
hr = WcaGetProperty(L"CustomActionData", &pwzData);
ExitOnFailure(hr, "failed to get CustomActionData");
if (pwzData)
{
appNameValue = pwzData;
}