Does taking mapping spaces with a connected space preserve disjoint unions?

Let $X$ be a connected topological space and $\{Y_i\}_{i\in I}$ a family of spaces. Since the image of a connected space is connected, we obtain a natural bijective map $$\textstyle\coprod\nolimits_{i\in I}\mathcal{C}(X,Y_i)\rightarrow \mathcal{C}\left(X,\coprod\nolimits_{i\in I}Y_i\right),$$ where $\mathcal{C}(A,B)$ is the space of continuous maps from $A$ to $B$ with the compact open topology.

Is this map a homeomorphism?

If not, is it a homeomorphism if the space $X$ is well-behaved with respect to the compact open topology, i.e. locally compact Hausdorff?

Since $\{ C(X, Y_i) \}_{i\in I}$ is an open cover of $\coprod_{i\in I} C(X, Y_i)$, it is enough to show that for every $k\in I$ the restriction $C(X, Y_k) \to C(X, \coprod_{i\in I} Y_i)$ is continuous and open. That this is a homeomorphic embedding already follows from the fact that it is induced by the embedding $Y_k \to \coprod_{i\in I} Y_i$.
It remains to verify that its image is open, and this is where the connectedness of $X$ comes in. If $p$ is any point in $X$, we have $$\left\{ f \in C(X, \coprod_{i\in I} Y_i) \mid f[X] \subset Y_k \right\} = \left\{ f \in C(X, \coprod_{i\in I} Y_i) \mid f(p) \in Y_k \right\}$$ where the left hand side is the image of our embedding and the right hand side is a basic open set.