You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to get a mime type of a directory in /js request.uri, the module returns application/javascript. Is this the expected behavior? If it is, please explain why.
In my application, when a request comes for a static file, I check whether user has access to this type of static resource. For this reason I need to determine the file mime. Sometime when users enter /js, /css, in which case mime module returns as if request comes for JS or CSS files, respectively. Obviously, this is a wrong behavior.
The expected behavior in such cases is to receive null or '' (an empty string) which would be easy to handle in the application.
The text was updated successfully, but these errors were encountered:
node-mime is only looking at the name string you give it; it does not use any filesystem information to determine mime type. I agree this case is debatable, but I don't think it's unreasonable to expect people who care about directory .vs. file type to do the necessary checks before calling into node-mime.
Trying to get a mime type of a directory in /js request.uri, the module returns
application/javascript
. Is this the expected behavior? If it is, please explain why.In my application, when a request comes for a static file, I check whether user has access to this type of static resource. For this reason I need to determine the file mime. Sometime when users enter /js, /css, in which case mime module returns as if request comes for JS or CSS files, respectively. Obviously, this is a wrong behavior.
The expected behavior in such cases is to receive
null
or''
(an empty string) which would be easy to handle in the application.The text was updated successfully, but these errors were encountered: