diff --git a/fck/cktype/__init__.py b/fck/cktype/__init__.py index 8622dfe..0dd0dec 100644 --- a/fck/cktype/__init__.py +++ b/fck/cktype/__init__.py @@ -18,12 +18,14 @@ def resolve(fname: str, esum: Optional[str] = None, cstype: str = ""): If neither is applicable it defaults to CRC32. """ cstype = cstype.upper() - if cstype in CKTYPES: - if esum is None and (match := CKTYPES[cstype].REGEX.search(fname)): - esum = match.group(0) - return CKTYPES[cstype](), esum + if cstype != "": + if cstype in CKTYPES: + if esum is None and (match := CKTYPES[cstype].REGEX.search(fname)): + esum = match.group(0) + return CKTYPES[cstype](), esum + raise ValueError(f"Unknown checksum type: {cstype}") - for cstname, csclass in CKTYPES.items(): + for csclass in CKTYPES.values(): if match := csclass.REGEX.search(fname): if esum is None: esum = match.group(0)