Skip to content

Commit da7f06f

Browse files
author
NI
committed
Adjust favicon a bit more
1 parent 8cbfb05 commit da7f06f

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

application/controller/static_page_generater/main.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ import "strings"
8888
// WARNING: THIS GENERATION IS FOR DEBUG / DEVELOPMENT ONLY, DO NOT
8989
// USE IT IN PRODUCTION!
9090
91+
func getMimeTypeByExtension(ext string) string {
92+
switch ext {
93+
case ".ico":
94+
return "image/x-icon"
95+
96+
case ".md":
97+
return "text/markdown"
98+
99+
default:
100+
return mime.TypeByExtension(ext)
101+
}
102+
}
103+
91104
func staticFileGen(fileName, filePath string) staticData {
92105
content, readErr := ioutil.ReadFile(filePath)
93106
@@ -134,7 +147,7 @@ func staticFileGen(fileName, filePath string) staticData {
134147
fileExt = fileName[fileExtDotIdx:len(fileName)]
135148
}
136149
137-
mimeType := mime.TypeByExtension(fileExt)
150+
mimeType := getMimeTypeByExtension(fileExt)
138151
139152
if len(mimeType) <= 0 {
140153
mimeType = "application/binary"
@@ -272,6 +285,19 @@ func byteToArrayStr(b []byte) string {
272285
return hex.EncodeToString(b)
273286
}
274287

288+
func getMimeTypeByExtension(ext string) string {
289+
switch ext {
290+
case ".ico":
291+
return "image/x-icon"
292+
293+
case ".md":
294+
return "text/markdown"
295+
296+
default:
297+
return mime.TypeByExtension(ext)
298+
}
299+
}
300+
275301
func parseFile(
276302
id int, name string, filePath string, packageName string) parsedFile {
277303
content, readErr := ioutil.ReadFile(filePath)
@@ -314,7 +340,7 @@ func parseFile(
314340
fileExt = name[fileExtDotIdx:len(name)]
315341
}
316342

317-
mimeType := mime.TypeByExtension(fileExt)
343+
mimeType := getMimeTypeByExtension(fileExt)
318344

319345
if len(mimeType) <= 0 {
320346
mimeType = "application/binary"

ui/sshwifty.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)