Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send 404 immediately for known public requests #11117

Merged
merged 5 commits into from
Apr 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename variable
  • Loading branch information
silverwind committed Apr 17, 2020
commit 13ed26aa236e8317740c24fd513e379b657f4c40
6 changes: 3 additions & 3 deletions modules/public/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type Options struct {
Prefix string
}

// List of entries inside the `public` directory
var resourceEntries = []string{
// List of known entries inside the `public` directory
var knownEntries = []string{
"js",
"css",
"fomantic",
Expand Down Expand Up @@ -112,7 +112,7 @@ func (opts *Options) handle(ctx *macaron.Context, log *log.Logger, opt *Options)
if len(parts) < 2 {
return false
}
for _, entry := range resourceEntries {
for _, entry := range knownEntries {
if entry == parts[1] {
ctx.Resp.WriteHeader(404)
return true
Expand Down