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
|
||||
nntp.message = nntpSanitize(pr.Message)
|
||||
|
||||
cites, err := self.daemon.database.FindCitesInText(nntp.message)
|
||||
cites, err := self.daemon.database.FindCitesInText(pr.Message)
|
||||
if err != nil {
|
||||
e(err)
|
||||
return
|
||||
|
@ -1921,15 +1921,14 @@ func (self *PostgresDatabase) GetNewsgroupList() (list NewsgroupList, err error)
|
||||
func (self *PostgresDatabase) FindCitesInText(text string) (msgids []string, err error) {
|
||||
hashes := findBacklinks(text)
|
||||
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 qparams []interface{}
|
||||
for idx := range hashes {
|
||||
params = append(params, fmt.Sprintf("$%d", idx+1))
|
||||
qparams = append(qparams, hashes[idx])
|
||||
params = append(params, fmt.Sprintf(" message_id_hash ILIKE $%d", idx+1))
|
||||
qparams = append(qparams, strings.Trim(hashes[idx][2:], " ")+"%")
|
||||
}
|
||||
q += strings.Join(params, ", ")
|
||||
q += " )"
|
||||
q += strings.Join(params, " OR ")
|
||||
var rows *sql.Rows
|
||||
rows, err = self.conn.Query(q, qparams...)
|
||||
if err == sql.ErrNoRows {
|
||||
|
Reference in New Issue
Block a user