-
|
Hi all! Trying to serve a file as an attachment. When file is located in the same folder as program - all ok. Is it a bug or I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
Please help! Echo v 3 behaves ok, but v fails |
Beta Was this translation helpful? Give feedback.
-
|
FWIW I had a similar issue in A quick and very dirty (would break lots of things in a real project) fix was to change the Filesystem in the Config and make sure the paths passed to config := echo.Config{
Filesystem: os.DirFS("/"),
}
e := echo.NewWithConfig(config)
// ...
e.GET("/", func(c *echo.Context) error {
filename := getSomeFilename()
filename = strings.TrimPrefix(filename, "/")
return c.Inline(filename, base)
})Trimming the leading slashes was needed for the paths to work with the |
Beta Was this translation helpful? Give feedback.
Please help!
Echo v 3 behaves ok, but v fails