Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
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
0
Merge Requests
0
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
caddy
Commits
4d066b7e
Commit
4d066b7e
authored
Jul 01, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ext: Only append extension if request is not for directory (fixes #173)
parent
16f18bfe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletion
+2
-1
dist/CHANGES.txt
dist/CHANGES.txt
+1
-0
middleware/extensions/ext.go
middleware/extensions/ext.go
+1
-1
No files found.
dist/CHANGES.txt
View file @
4d066b7e
...
...
@@ -6,6 +6,7 @@ CHANGES
- browse: Sort by clicking column heading or using query string
- core: Serving hostname that doesn't resolve issues warning then listens on 0.0.0.0
- errors: Missing error page during parse time is warning, not error
- ext: Extension only appended if request path does not end in /
- fastcgi: Fix for backend responding without status text
- fastcgi: Fix PATH_TRANSLATED when PATH_INFO is empty (RFC 3875)
- gzip: Enable by file path and/or extension
...
...
middleware/extensions/ext.go
View file @
4d066b7e
...
...
@@ -31,7 +31,7 @@ type Ext struct {
// ServeHTTP implements the middleware.Handler interface.
func
(
e
Ext
)
ServeHTTP
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
(
int
,
error
)
{
urlpath
:=
strings
.
TrimSuffix
(
r
.
URL
.
Path
,
"/"
)
if
path
.
Ext
(
urlpath
)
==
""
{
if
path
.
Ext
(
urlpath
)
==
""
&&
r
.
URL
.
Path
[
len
(
r
.
URL
.
Path
)
-
1
]
!=
'/'
{
for
_
,
ext
:=
range
e
.
Extensions
{
if
resourceExists
(
e
.
Root
,
urlpath
+
ext
)
{
r
.
URL
.
Path
=
urlpath
+
ext
...
...
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