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
Awestruct rewrites the path from /foobar/ to /foobar/index.html then checks to see if index.html exists in that directory. If index.html does not exist, then it continues the request with the original path /foobar/, but treats it as a file.
if ( File.exist?( fs_path ) ) {
body = read_content( fs_path ) # failure occurs here
}
When fs_path is a directory (e.g., /foobar/), the code above leads to the error that the content is a directory. It should, instead, follow the 404 path.
if ( File.file?( fs_path ) ) {
body = read_content( fs_path ) # now we are sure it's a file and we can read it
}
We have to be careful with File.exist?. It does not check for files only, but rather files or directories.
The text was updated successfully, but these errors were encountered:
Awestruct rewrites the path from /foobar/ to /foobar/index.html then checks to see if index.html exists in that directory. If index.html does not exist, then it continues the request with the original path /foobar/, but treats it as a file.
When fs_path is a directory (e.g.,
/foobar/
), the code above leads to the error that the content is a directory. It should, instead, follow the 404 path.We have to be careful with
File.exist?
. It does not check for files only, but rather files or directories.The text was updated successfully, but these errors were encountered: