-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
protocol Phoenix.HTML.Safe not implemented for type Plug.Upload (a struct). This protocol is implemented for the following type(s): Atom, BitString, Date, DateTime, Decimal, Float, Integer, List, NaiveDateTime, Phoenix.LiveComponent.CID, Phoenix.LiveView.Component, Phoenix.LiveView.Comprehension, Phoenix.LiveView.JS, Phoenix.LiveView.Rendered, Time, Tuple, URI
Got value:
%Plug.Upload{
path: "/tmp/plug-1746-jOze/multipart-1746785255-482507851159-8",
content_type: "image/png",
filename: "image.png"
}
phoenix/installer/templates/phx_web/components/core_components.ex
Lines 244 to 265 in 4f2afe7
| # All other inputs text, datetime-local, url, password, etc. are handled here... | |
| def input(assigns) do | |
| ~H""" | |
| <fieldset class="fieldset mb-2"> | |
| <label> | |
| <span :if={@label} class="label mb-1">{@label}</span> | |
| <input | |
| type={@type} | |
| name={@name} | |
| id={@id} | |
| value={Phoenix.HTML.Form.normalize_value(@type, @value)} | |
| class={[ | |
| @class || "w-full input", | |
| @errors != [] && (@error_class || "input-error") | |
| ]} | |
| {@rest} | |
| /> | |
| </label> | |
| <.error :for={msg <- @errors}>{msg}</.error> | |
| </fieldset> | |
| """ | |
| end |
Perhaps Phoenix.HTML.Form.normalize_value should set the value to empty string("") for file inputs. Have created a PR in phoenix_html library to address this.
Metadata
Metadata
Assignees
Labels
No labels