forked from aio-libs/aiohttp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.10] Handle 403 and 404 issues in FileResponse class (aio-libs#8538)
(cherry picked from commit 4f834b6) Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
138 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Adjusted ``FileResponse`` to check file existence and access when preparing the response -- by :user:`steverep`. | ||
|
||
The :py:class:`~aiohttp.web.FileResponse` class was modified to respond with | ||
403 Forbidden or 404 Not Found as appropriate. Previously, it would cause a | ||
server error if the path did not exist or could not be accessed. Checks for | ||
existence, non-regular files, and permissions were expected to be done in the | ||
route handler. For static routes, this now permits a compressed file to exist | ||
without its uncompressed variant and still be served. In addition, this | ||
changes the response status for files without read permission to 403, and for | ||
non-regular files from 404 to 403 for consistency. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters