Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
05df7741
Commit
05df7741
authored
Jan 18, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-development-mode' into 'master'
Develomentmode ended up the wrong way around See merge request !29
parents
9530b40d
c87a6d91
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
internal/staticpages/error_pages.go
internal/staticpages/error_pages.go
+2
-2
internal/staticpages/error_pages_test.go
internal/staticpages/error_pages_test.go
+3
-3
internal/upstream/routes.go
internal/upstream/routes.go
+2
-2
No files found.
internal/staticpages/error_pages.go
View file @
05df7741
...
...
@@ -60,8 +60,8 @@ func (s *errorPageResponseWriter) Flush() {
s
.
WriteHeader
(
http
.
StatusOK
)
}
func
(
st
*
Static
)
ErrorPages
(
en
abled
bool
,
handler
http
.
Handler
)
http
.
Handler
{
if
!
en
abled
{
func
(
st
*
Static
)
ErrorPages
Unless
(
dis
abled
bool
,
handler
http
.
Handler
)
http
.
Handler
{
if
dis
abled
{
return
handler
}
return
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
...
...
internal/staticpages/error_pages_test.go
View file @
05df7741
...
...
@@ -27,7 +27,7 @@ func TestIfErrorPageIsPresented(t *testing.T) {
fmt
.
Fprint
(
w
,
"Not Found"
)
})
st
:=
&
Static
{
dir
}
st
.
ErrorPages
(
tru
e
,
h
)
.
ServeHTTP
(
w
,
nil
)
st
.
ErrorPages
Unless
(
fals
e
,
h
)
.
ServeHTTP
(
w
,
nil
)
w
.
Flush
()
testhelper
.
AssertResponseCode
(
t
,
w
,
404
)
...
...
@@ -48,7 +48,7 @@ func TestIfErrorPassedIfNoErrorPageIsFound(t *testing.T) {
fmt
.
Fprint
(
w
,
errorResponse
)
})
st
:=
&
Static
{
dir
}
st
.
ErrorPages
(
tru
e
,
h
)
.
ServeHTTP
(
w
,
nil
)
st
.
ErrorPages
Unless
(
fals
e
,
h
)
.
ServeHTTP
(
w
,
nil
)
w
.
Flush
()
testhelper
.
AssertResponseCode
(
t
,
w
,
404
)
...
...
@@ -72,7 +72,7 @@ func TestIfErrorPageIsIgnoredInDevelopment(t *testing.T) {
fmt
.
Fprint
(
w
,
serverError
)
})
st
:=
&
Static
{
dir
}
st
.
ErrorPages
(
fals
e
,
h
)
.
ServeHTTP
(
w
,
nil
)
st
.
ErrorPages
Unless
(
tru
e
,
h
)
.
ServeHTTP
(
w
,
nil
)
w
.
Flush
()
testhelper
.
AssertResponseCode
(
t
,
w
,
500
)
testhelper
.
AssertResponseBody
(
t
,
w
,
serverError
)
...
...
internal/upstream/routes.go
View file @
05df7741
...
...
@@ -84,13 +84,13 @@ func (u *Upstream) configureRoutes() {
// To prevent anybody who knows/guesses the URL of a user-uploaded file
// from downloading it we make sure requests to /uploads/ do _not_ pass
// through static.ServeExisting.
route
{
""
,
regexp
.
MustCompile
(
`^/uploads/`
),
static
.
ErrorPages
(
u
.
DevelopmentMode
,
proxy
)},
route
{
""
,
regexp
.
MustCompile
(
`^/uploads/`
),
static
.
ErrorPages
Unless
(
u
.
DevelopmentMode
,
proxy
)},
// Serve static files or forward the requests
route
{
""
,
nil
,
static
.
ServeExisting
(
u
.
URLPrefix
,
staticpages
.
CacheDisabled
,
static
.
DeployPage
(
static
.
ErrorPages
(
u
.
DevelopmentMode
,
static
.
ErrorPages
Unless
(
u
.
DevelopmentMode
,
proxy
,
),
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment