How to prepend value to link href

Newbie Question (experimenting a bit)

in files_live.ex

Having this code, which outputs a link with the path of a file in file.path in a render(assigns) function, how should I prepend “file:///” to the file.path so that it shows up like file:///mypath instead of localhost:4000/mypath ?

Tried several things with concatenation but nothing seemed to work

  <%= for file <- @files do %>
    <.link href={file.path}>   <%= file.filename %></.link>
 <% end %>

Found the solution to my question although accessing a file with file:/// seems to be discouraged so the file apparently needs to be served through the application endpoint

def render(assigns) do
~H"""
 <%= for file <- @files do %>
     <% filename = "file://" <> file.path %>
     <%= link_with_file_protocol(filename, file.filename) %>
 <% end %>
 """

 defp link_with_file_protocol(url, text) do
    content_tag(:a, text, href: url, target: "_blank")
 end