Add NewDefaultFS function to help create filesystem that allows absolute paths by aldas · Pull Request #2931 · labstack/echo · GitHub
Skip to content

Add NewDefaultFS function to help create filesystem that allows absolute paths#2931

Merged
aldas merged 3 commits into
labstack:masterfrom
aldas:newdefaulfs_func
Mar 31, 2026
Merged

Add NewDefaultFS function to help create filesystem that allows absolute paths#2931
aldas merged 3 commits into
labstack:masterfrom
aldas:newdefaulfs_func

Conversation

@aldas

@aldas aldas commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Add NewDefaultFS function to help create filesystem that allows absolute paths with Open method.

fs.FS does not like paths like /tmp/temp.file even if fs is created like `os.DirFS("/"). You need to remove leading slash.

Also when file is absolute (/tmp/temp.file) and has same prefix as filesystem os.DirFS("/tmp/") this would not work. Echo defaultFs was working similarly to os.Open and therefore allowed absolute paths.

This PR makes echo.defaultFs to accept absolute path filenames in Open when it matches the filesystem prefix.

Relates to #2929

@codecov

codecov Bot commented Mar 31, 2026

Copy link
Copy Markdown

@aldas aldas merged commit a7005b2 into labstack:master Mar 31, 2026
10 checks passed
@aldas aldas deleted the newdefaulfs_func branch March 31, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant