Skip to content

Commit 7f4fb74

Browse files
committed
Merge pull request revel#809 from revel/patch/fixed_params
Static module: get prefix from fixed params explicitly
2 parents f1b96a4 + 6f2b71e commit 7f4fb74

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A high productivity, full-stack web framework for the [Go language](http://www.golang.org).
44

5-
Current Version: 0.11.1 (Oct 27, 2014)
5+
Current Version: 0.11.2 (Nov 23, 2014)
66

77
**As of Revel 0.11.0, Go 1.3+ is required.**
88

modules/static/app/controllers/static.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@ type Static struct {
4343
// Calls:
4444
// Static.Serve("public/img", "favicon.png")
4545
func (c Static) Serve(prefix, filepath string) revel.Result {
46-
var basePath string
46+
// Fix for #503.
47+
prefix = c.Params.Fixed.Get("prefix")
48+
if prefix == "" {
49+
return c.NotFound("")
50+
}
4751

52+
var basePath string
4853
if !fpath.IsAbs(prefix) {
4954
basePath = revel.BasePath
5055
}
@@ -87,6 +92,12 @@ func (c Static) Serve(prefix, filepath string) revel.Result {
8792
// as Static.Serve with the additional module name pre-pended to the list of
8893
// arguments.
8994
func (c Static) ServeModule(moduleName, prefix, filepath string) revel.Result {
95+
// Fix for #503.
96+
prefix = c.Params.Fixed.Get("prefix")
97+
if prefix == "" {
98+
return c.NotFound("")
99+
}
100+
90101
var basePath string
91102
for _, module := range revel.Modules {
92103
if module.Name == moduleName {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy