Skip to content

Commit cc8ff49

Browse files
committed
fix: handle AppConfigTypeConflictException when array policy stored as string
When a policy with an array default (e.g. identify_methods) has its value stored as a plain string by an external source (e.g. the Nextcloud provisioning API), readSystemValue() was re-throwing AppConfigTypeConflictException instead of gracefully falling back. Return the raw string so the policy normalizer can decode it. Signed-off-by: Vitor Mattos <[email protected]>
1 parent 2b96e94 commit cc8ff49

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/Service/Policy/Runtime/PolicySource.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,16 @@ private function readSystemValue(string $key, mixed $defaultValue): mixed {
603603
return $this->appConfig->getAppValueString($key, $defaultValue ? '1' : '0');
604604
}
605605

606+
if (is_array($defaultValue)) {
607+
// Value was stored as a scalar (e.g., by Nextcloud provisioning API).
608+
// Return the raw string so the policy normalizer can decode it.
609+
try {
610+
return $this->appConfig->getAppValueString($key, '');
611+
} catch (AppConfigTypeConflictException) {
612+
return $defaultValue;
613+
}
614+
}
615+
606616
throw $exception;
607617
}
608618
}

0 commit comments

Comments
 (0)