Skip to content

Commit

Permalink
Adjust favicon a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
NI committed Oct 1, 2019
1 parent 8cbfb05 commit da7f06f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
30 changes: 28 additions & 2 deletions application/controller/static_page_generater/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ import "strings"
// WARNING: THIS GENERATION IS FOR DEBUG / DEVELOPMENT ONLY, DO NOT
// USE IT IN PRODUCTION!
func getMimeTypeByExtension(ext string) string {
switch ext {
case ".ico":
return "image/x-icon"
case ".md":
return "text/markdown"
default:
return mime.TypeByExtension(ext)
}
}
func staticFileGen(fileName, filePath string) staticData {
content, readErr := ioutil.ReadFile(filePath)
Expand Down Expand Up @@ -134,7 +147,7 @@ func staticFileGen(fileName, filePath string) staticData {
fileExt = fileName[fileExtDotIdx:len(fileName)]
}
mimeType := mime.TypeByExtension(fileExt)
mimeType := getMimeTypeByExtension(fileExt)
if len(mimeType) <= 0 {
mimeType = "application/binary"
Expand Down Expand Up @@ -272,6 +285,19 @@ func byteToArrayStr(b []byte) string {
return hex.EncodeToString(b)
}

func getMimeTypeByExtension(ext string) string {
switch ext {
case ".ico":
return "image/x-icon"

case ".md":
return "text/markdown"

default:
return mime.TypeByExtension(ext)
}
}

func parseFile(
id int, name string, filePath string, packageName string) parsedFile {
content, readErr := ioutil.ReadFile(filePath)
Expand Down Expand Up @@ -314,7 +340,7 @@ func parseFile(
fileExt = name[fileExtDotIdx:len(name)]
}

mimeType := mime.TypeByExtension(fileExt)
mimeType := getMimeTypeByExtension(fileExt)

if len(mimeType) <= 0 {
mimeType = "application/binary"
Expand Down
2 changes: 1 addition & 1 deletion ui/sshwifty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit da7f06f

Please sign in to comment.