MustSubFS creates sub FS from current filesystem or panic on failure. Panic happens when `fsRoot` contains invalid path according to `fs.ValidPath` rules. MustSubFS is helpful when dealing with `embed.FS` because for example `//go:embed assets/images` embeds files with paths including `assets/image
(currentFs fs.FS, fsRoot string)
| 917 | // paths including `assets/images` as their prefix. In that case use `fs := echo.MustSubFS(fs, "rootDirectory") to |
| 918 | // create sub fs which uses necessary prefix for directory path. |
| 919 | func MustSubFS(currentFs fs.FS, fsRoot string) fs.FS { |
| 920 | subFs, err := subFS(currentFs, fsRoot) |
| 921 | if err != nil { |
| 922 | panic(fmt.Errorf("can not create sub FS, invalid root given, err: %w", err)) |
| 923 | } |
| 924 | return subFs |
| 925 | } |
| 926 | |
| 927 | func sanitizeURI(uri string) string { |
| 928 | // double slash `\\`, `//` or even `\/` is absolute uri for browsers and by redirecting request to that uri |
searching dependent graphs…