cmd/tclipd: handle untitled pastes better
Fixes #29 Signed-off-by: Xe Iaso <xe@tailscale.com>
This commit is contained in:
parent
2e7c605549
commit
0ecf363607
|
@ -126,6 +126,10 @@ LIMIT 5
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if jpi.Filename == "" {
|
||||||
|
jpi.Filename = "untitled"
|
||||||
|
}
|
||||||
|
|
||||||
jpis = append(jpis, jpi)
|
jpis = append(jpis, jpi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,6 +225,10 @@ func (s *Server) TailnetSubmitPaste(w http.ResponseWriter, r *http.Request) {
|
||||||
data := r.Form.Get("content")
|
data := r.Form.Get("content")
|
||||||
id := uuid.NewString()
|
id := uuid.NewString()
|
||||||
|
|
||||||
|
if fname == "" {
|
||||||
|
fname = "untitled"
|
||||||
|
}
|
||||||
|
|
||||||
q := `
|
q := `
|
||||||
INSERT INTO pastes
|
INSERT INTO pastes
|
||||||
( id
|
( id
|
||||||
|
@ -322,6 +330,10 @@ OFFSET ?1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if jpi.Filename == "" {
|
||||||
|
jpi.Filename = "untitled"
|
||||||
|
}
|
||||||
|
|
||||||
jpis = append(jpis, jpi)
|
jpis = append(jpis, jpi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,6 +514,10 @@ WHERE p.id = ?1`
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fname == "" {
|
||||||
|
fname = "untitled"
|
||||||
|
}
|
||||||
|
|
||||||
lang := enry.GetLanguage(fname, []byte(data))
|
lang := enry.GetLanguage(fname, []byte(data))
|
||||||
|
|
||||||
var rawHTML *template.HTML
|
var rawHTML *template.HTML
|
||||||
|
|
Loading…
Reference in a new issue