The generalized Cantor space is the space $2^\kappa$, with basic open sets $$ [\sigma] := \{f\in 2^\kappa : \sigma\subseteq f\}, $$ for $\sigma\in 2^{<\kappa}$.
A space is $\kappa$-compact if every open cover has a subcover of cardinality (strictly) smaller than $\kappa$.
For which cardinals $\kappa$ does the generalized Cantor space $2^\kappa$ embed as a subspace of every $\kappa$-compact set $C\subseteq 2^\kappa$ with $|C|>\kappa$?
It is a classic result that this holds for $\kappa=\omega$. We (my colleagues and I) are particularly interested, in light of an earlier answer, in the case where $\kappa$ is weakly compact, and the expected answer is "for all of these". Even if so, we would appreciate references.