fix Go peeing itself
This commit is contained in:
parent
77ba4bded8
commit
d86bc6e1db
|
@ -49,7 +49,7 @@ func PostNewHandler(c echo.Context) error {
|
|||
}
|
||||
}
|
||||
// Determine language from file extension if not set.
|
||||
if lang == "" {
|
||||
if lang == "" && name != "" {
|
||||
lexer := lexers.Match(name)
|
||||
if lexer != nil {
|
||||
lang = lexer.Config().Name
|
||||
|
@ -61,10 +61,13 @@ func PostNewHandler(c echo.Context) error {
|
|||
return utils.RenderErrorToast(c, "server-side error occurred")
|
||||
}
|
||||
|
||||
binPartial := pages.BinPartial(createdFile)
|
||||
setTitle := components.SetTitle(name)
|
||||
|
||||
utils.SetHeader(c, "HX-Push", fmt.Sprintf("/b/%s", code))
|
||||
return utils.RenderComponents(c, http.StatusOK,
|
||||
pages.BinPartial(createdFile),
|
||||
components.SetTitle(file.Filename),
|
||||
binPartial,
|
||||
setTitle,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue