mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-26 19:05:13 +00:00
fix(config): match per-service cdm keys case-insensitively
cdm lookups used the raw service key while decryption upper-cases its keys, so a case-mismatched cdm entry silently used the default. Add a shared ci_get helper, route cdm/decryption through resolvers, drop a redundant decryption mutation and dead downloader writes, and add a regression bench.
This commit is contained in:
@@ -38,6 +38,19 @@ def flatten(items: Any, ignore_types: Union[Type, Tuple[Type, ...]] = str) -> It
|
||||
yield items
|
||||
|
||||
|
||||
def ci_get(mapping: dict, key: str, default: Any = None) -> Any:
|
||||
"""Case-insensitive top-level lookup, for per-service config maps."""
|
||||
if not mapping:
|
||||
return default
|
||||
if key in mapping:
|
||||
return mapping[key]
|
||||
kl = key.lower()
|
||||
for k, v in mapping.items():
|
||||
if isinstance(k, str) and k.lower() == kl:
|
||||
return v
|
||||
return default
|
||||
|
||||
|
||||
def merge_dict(source: dict, destination: dict) -> None:
|
||||
"""Recursively merge Source into Destination in-place."""
|
||||
if not source:
|
||||
|
||||
Reference in New Issue
Block a user