Reputation: 13
Whenever I try to serve content (via send_file or as the src of an iframe) from a directory outside of 'public' via the asset's relative or absolute path I get an error stating either the asset could not be found or 'c' (as in C:) is not a valid protocol. Does anyone know why I'm facing these problems and how to solve them without using symlink?
Thanks.
Upvotes: 1
Views: 520
Reputation: 2554
This is just a guess, as I don't use Windows for anything other than browser testing.
Instead of creating the string for the file path (e.g. send_file "C:\sites\this_one\secure_files\here.pdf"
) use the File class to build the path (e.g. send_file File.join(Rails.root, 'secure_files', 'here.pdf')
).
Upvotes: 1