--- lbbs/src/article_post.c 2025/06/14 09:20:13 1.8 +++ lbbs/src/article_post.c 2025/06/14 11:59:09 1.11 @@ -731,6 +731,11 @@ int article_reply(const SECTION_LIST *p_ memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i])); len += (line_offsets[i + 1] - line_offsets[i]); } + if (content[len - 1] != '\n') // Appennd \n if not exist + { + content[len] = '\n'; + len++; + } content[len] = '\0'; free(content_f); @@ -970,8 +975,9 @@ int article_reply(const SECTION_LIST *p_ snprintf(sql, sizeof(sql), "INSERT INTO bbs(SID, TID, UID, username, nickname, title, CID, transship, " "sub_dt, sub_ip, reply_note, exp, last_reply_dt, icon, length) " - "VALUES(%d, 0, %d, '%s', '%s', '%s', %d, 0, NOW(), '%s', 1, %d, NOW(), 1, %ld)", - p_section->sid, BBS_priv.uid, BBS_username, nickname_f, title_f, + "VALUES(%d, %d, %d, '%s', '%s', '%s', %d, 0, NOW(), '%s', 1, %d, NOW(), 1, %ld)", + p_section->sid, (p_article->tid == 0 ? p_article->aid : p_article->tid), + BBS_priv.uid, BBS_username, nickname_f, title_f, p_article_new->cid, hostaddr_client, BBS_user_exp, len_content); if (mysql_query(db, sql) != 0)