make it work
This commit is contained in:
parent
d2887a99b4
commit
b61012fc43
@ -866,7 +866,7 @@ func (self *httpFrontend) handle_postRequest(pr *postRequest, b bannedFunc, e er
|
|||||||
// set message
|
// set message
|
||||||
nntp.message = nntpSanitize(pr.Message)
|
nntp.message = nntpSanitize(pr.Message)
|
||||||
|
|
||||||
cites, err := self.daemon.database.FindCitesInText(nntp.message)
|
cites, err := self.daemon.database.FindCitesInText(pr.Message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e(err)
|
e(err)
|
||||||
return
|
return
|
||||||
|
@ -1921,15 +1921,14 @@ func (self *PostgresDatabase) GetNewsgroupList() (list NewsgroupList, err error)
|
|||||||
func (self *PostgresDatabase) FindCitesInText(text string) (msgids []string, err error) {
|
func (self *PostgresDatabase) FindCitesInText(text string) (msgids []string, err error) {
|
||||||
hashes := findBacklinks(text)
|
hashes := findBacklinks(text)
|
||||||
if len(hashes) > 0 {
|
if len(hashes) > 0 {
|
||||||
q := "SELECT message_id FROM Articles WHERE message_id_hash IN ( "
|
q := "SELECT message_id FROM Articles WHERE "
|
||||||
var params []string
|
var params []string
|
||||||
var qparams []interface{}
|
var qparams []interface{}
|
||||||
for idx := range hashes {
|
for idx := range hashes {
|
||||||
params = append(params, fmt.Sprintf("$%d", idx+1))
|
params = append(params, fmt.Sprintf(" message_id_hash ILIKE $%d", idx+1))
|
||||||
qparams = append(qparams, hashes[idx])
|
qparams = append(qparams, strings.Trim(hashes[idx][2:], " ")+"%")
|
||||||
}
|
}
|
||||||
q += strings.Join(params, ", ")
|
q += strings.Join(params, " OR ")
|
||||||
q += " )"
|
|
||||||
var rows *sql.Rows
|
var rows *sql.Rows
|
||||||
rows, err = self.conn.Query(q, qparams...)
|
rows, err = self.conn.Query(q, qparams...)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
|
Reference in New Issue
Block a user