Skip to content

Commit efe0314

Browse files
committed
fix: typo assert -> asset
1 parent cd71cc9 commit efe0314

File tree

10 files changed

+21
-21
lines changed

10 files changed

+21
-21
lines changed

src/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ endef
66

77
tpls:
88
$(call embed, tpl/page.html)
9-
sed -i -e 's;/../assert/;?assert=;g' tpl/page.html.go
9+
sed -i -e 's;/../asset/;?asset=;g' tpl/page.html.go
1010

11-
$(call embed, tpl/assert/main.css)
11+
$(call embed, tpl/asset/main.css)
1212

13-
$(call embed, tpl/assert/main.js)
13+
$(call embed, tpl/asset/main.js)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package serverHandler
22

33
import (
4-
"../tpl/assert"
4+
"../tpl/asset"
55
"net/http"
66
"time"
77
)
88

99
var initTime = time.Now()
1010

11-
func (h *handler) assert(w http.ResponseWriter, r *http.Request, assertPath string) {
12-
content, ok := assert.Get(assertPath)
11+
func (h *handler) asset(w http.ResponseWriter, r *http.Request, assetPath string) {
12+
content, ok := asset.Get(assetPath)
1313
if !ok {
1414
return
1515
}
@@ -18,6 +18,6 @@ func (h *handler) assert(w http.ResponseWriter, r *http.Request, assertPath stri
1818
header.Set("Content-Type", content.ContentType)
1919
header.Set("Cache-Control", "public, max-age=3600")
2020
if needResponseBody(r.Method) {
21-
http.ServeContent(w, r, assertPath, initTime, content.ReadSeeker)
21+
http.ServeContent(w, r, assetPath, initTime, content.ReadSeeker)
2222
}
2323
}

src/serverHandler/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ type handler struct {
6060
func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
6161
go h.logRequest(r)
6262

63-
// assert
64-
const assertPrefix = "assert="
65-
if strings.HasPrefix(r.URL.RawQuery, assertPrefix) {
66-
assertPath := r.URL.RawQuery[len(assertPrefix):]
67-
h.assert(w, r, assertPath)
63+
// asset
64+
const assetPrefix = "asset="
65+
if strings.HasPrefix(r.URL.RawQuery, assetPrefix) {
66+
assetPath := r.URL.RawQuery[len(assetPrefix):]
67+
h.asset(w, r, assetPath)
6868
return
6969
}
7070

File renamed without changes.

src/tpl/assert/main.css.go renamed to src/tpl/asset/main.css.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package assert
1+
package asset
22

33
const mainCss = `
44
html, body {

src/tpl/assert/main.go renamed to src/tpl/asset/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package assert
1+
package asset
22

33
import (
44
"io"
@@ -10,12 +10,12 @@ type content struct {
1010
ReadSeeker io.ReadSeeker
1111
}
1212

13-
var asserts = map[string]content{
13+
var assets = map[string]content{
1414
"main.css": {"text/css", strings.NewReader(mainCss)},
1515
"main.js": {"application/javascript", strings.NewReader(mainJs)},
1616
}
1717

1818
func Get(path string) (content, bool) {
19-
c, ok := asserts[path]
19+
c, ok := assets[path]
2020
return c, ok
2121
}
File renamed without changes.

src/tpl/assert/main.js.go renamed to src/tpl/asset/main.js.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package assert
1+
package asset
22

33
const mainJs = `
44
(function () {

src/tpl/page.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<meta name="renderer" content="webkit"/>
99
<meta name="wap-font-scale" content="no"/>
1010
<title>{{.Path}}</title>
11-
<link rel="stylesheet" type="text/css" href="{{.RootRelPath}}/../assert/main.css"/>
11+
<link rel="stylesheet" type="text/css" href="{{.RootRelPath}}/../asset/main.css"/>
1212
</head>
1313
<body class="{{if .IsRoot}}root-dir{{else}}sub-dir{{end}}">
1414
{{$contextQueryString := .Context.QueryString}}
@@ -98,6 +98,6 @@
9898
<div class="error">500 potential issue occurred</div>
9999
{{end}}
100100

101-
<script type="text/javascript" src="{{.RootRelPath}}/../assert/main.js" defer="defer" async="async"></script>
101+
<script type="text/javascript" src="{{.RootRelPath}}/../asset/main.js" defer="defer" async="async"></script>
102102
</body>
103103
</html>

src/tpl/page.html.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const pageTplStr = `
1818
<meta name="renderer" content="webkit"/>
1919
<meta name="wap-font-scale" content="no"/>
2020
<title>{{.Path}}</title>
21-
<link rel="stylesheet" type="text/css" href="{{.RootRelPath}}?assert=main.css"/>
21+
<link rel="stylesheet" type="text/css" href="{{.RootRelPath}}?asset=main.css"/>
2222
</head>
2323
<body class="{{if .IsRoot}}root-dir{{else}}sub-dir{{end}}">
2424
{{$contextQueryString := .Context.QueryString}}
@@ -101,7 +101,7 @@ return confirm('Delete?\n' + name);
101101
{{else if eq .Status 500}}
102102
<div class="error">500 potential issue occurred</div>
103103
{{end}}
104-
<script type="text/javascript" src="{{.RootRelPath}}?assert=main.js" defer="defer" async="async"></script>
104+
<script type="text/javascript" src="{{.RootRelPath}}?asset=main.js" defer="defer" async="async"></script>
105105
</body>
106106
</html>
107107
`

0 commit comments

Comments
 (0)