elysiajs / elysia-static

Plugin for Elysia for serving static folder
MIT License
12 stars 17 forks source link

Navigate to folder `public/` throws `File must be regular or FIFO` error #17

Closed bogeychan closed 10 months ago

bogeychan commented 12 months ago

Code to reproduce

import { Elysia } from 'elysia';
import { staticPlugin } from '@elysiajs/static';

new Elysia().use(staticPlugin()).listen(8080);

Folder structure

Navigate to

Error

EINVAL: File must be regular or FIFO
   path: "public/"
 syscall: "sendfile"
   errno: -22

GET - http://localhost:8080/public/ failed

Environment

bogeychan commented 12 months ago

as a workaround one can add ignore patterns for each folder and subfolder like:

Folder structure:

staticPlugin({
  ignorePatterns: [/public\/?/, /public\/nested\/?/]
});

make sure to include the default patterns too: https://github.com/elysiajs/elysia-static/blob/403223119bdc52910c75044b7cf5ebf4bda01699/src/index.ts#L29

tnfAngel commented 10 months ago

Same for me