Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imghost-frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Janne Koschinski
imghost-frontend
Compare Revisions
321e8fbd16a8214e712ef8c03a6abdebf035fd1e...a0a6a35aadb91054df8fccf25cb641e9c8365b95
Source
a0a6a35aadb91054df8fccf25cb641e9c8365b95
Select Git revision
...
Target
321e8fbd16a8214e712ef8c03a6abdebf035fd1e
Select Git revision
Compare
Commits (2)
Ignore File Extensions for Images
· 730df3d6
Janne Koschinski
authored
Dec 07, 2018
730df3d6
Updated node dependencies
· a0a6a35a
Janne Koschinski
authored
Dec 07, 2018
a0a6a35a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
package.json
package.json
+1
-1
page_index.go
page_index.go
+11
-0
No files found.
package.json
View file @
a0a6a35a
...
...
@@ -4,6 +4,6 @@
"build"
:
"npm run sass"
},
"devDependencies"
:
{
"
node-sass
"
:
"
^4.
7.2
"
"
node-sass
"
:
"
^4.
10.0
"
}
}
page_index.go
View file @
a0a6a35a
...
...
@@ -2,12 +2,22 @@ package main
import
(
"net/http"
"strings"
)
type
IndexData
struct
{
User
UserInfo
}
func
removeFileExtensions
(
path
string
)
string
{
var
i
=
strings
.
IndexByte
(
path
,
'.'
)
if
i
<
0
{
return
path
}
else
{
return
path
[
0
:
i
]
}
}
func
pageIndex
(
ctx
PageContext
)
http
.
Handler
{
return
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
if
r
.
URL
.
Path
==
"/"
{
...
...
@@ -33,6 +43,7 @@ func pageIndex(ctx PageContext) http.Handler {
}
else
{
w
.
Header
()
.
Set
(
"Vary"
,
"Accept-Encoding"
)
w
.
Header
()
.
Set
(
"Cache-Control"
,
"public, max-age=31536000"
)
r
.
URL
.
Path
=
removeFileExtensions
(
r
.
URL
.
Path
)
ctx
.
Images
.
ServeHTTP
(
w
,
r
)
}
})
...
...