encode channel name when needed
This commit is contained in:
parent
5414a92561
commit
3c8fe6097c
@ -567,7 +567,7 @@ router.get("/api/getPosts", async function(req,res) {
|
|||||||
res.set("Access-Control-Allow-Origin","*")
|
res.set("Access-Control-Allow-Origin","*")
|
||||||
if(req.query.channel != undefined) {
|
if(req.query.channel != undefined) {
|
||||||
let sql = `select post_user_name,post_text,post_time,post_special_text,post_id,post_from_bot,post_reply_id from ipost.posts where post_receiver_name = ? group by post_id order by post_id desc limit 30;`
|
let sql = `select post_user_name,post_text,post_time,post_special_text,post_id,post_from_bot,post_reply_id from ipost.posts where post_receiver_name = ? group by post_id order by post_id desc limit 30;`
|
||||||
con.query(sql, [req.query.channel], function (err, result) {
|
con.query(sql, [encodeURIComponent(req.query.channel)], function (err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
res.json(result)
|
res.json(result)
|
||||||
});
|
});
|
||||||
@ -584,7 +584,7 @@ router.get("/api/getPostsLowerThan", async function(req,res) {
|
|||||||
res.set("Access-Control-Allow-Origin","*")
|
res.set("Access-Control-Allow-Origin","*")
|
||||||
if(req.query.channel != undefined) {
|
if(req.query.channel != undefined) {
|
||||||
let sql = `select post_user_name,post_text,post_time,post_special_text,post_id,post_from_bot,post_reply_id from ipost.posts where ((post_receiver_name = ?) and (post_id < ?)) group by post_id order by post_id desc limit 30;`
|
let sql = `select post_user_name,post_text,post_time,post_special_text,post_id,post_from_bot,post_reply_id from ipost.posts where ((post_receiver_name = ?) and (post_id < ?)) group by post_id order by post_id desc limit 30;`
|
||||||
con.query(sql, [req.query.channel,req.query.id], function (err, result) {
|
con.query(sql, [encodeURIComponent(req.query.channel),req.query.id], function (err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
res.json(result)
|
res.json(result)
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user