Skip to content

Commit

Permalink
Log_Manager::check_write: skip heading continuous newlines for early-…
Browse files Browse the repository at this point in the history
…check

先頭に空白行が連続する書き込みをすると、5chの仕様ではそれらを
削除したものが帰ってくるので、Log_Manager::check_write で
簡易チェックをするとき、先頭の連続する改行は読み飛ばす

不具合報告:
https://next2ch.net/test/read.cgi/linux/1654053581/112-113
  • Loading branch information
jd Fedora maintainer committed Aug 12, 2023
1 parent a6bb171 commit 2f761b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/message/logmanager.cpp
Expand Up @@ -196,6 +196,16 @@ bool Log_Manager::check_write( const std::string& url, const bool newthread, con
if( i && i2
&& ( item.head[ i ] == '\0' || msg[ i2 ] == '\0' ) ) break;

// 5chでは、先頭が連続する空白行の場合、その空白行が削除されたmsgが返ってくるので、
// 先頭が空白行の場合は読み飛ばす
if ( i == 0 ) {
while ( item.head [ i ] == '\n' ) ++i;
}
if ( i2 == 0 ) {
while ( msg [ i2 ] == '\n' ) ++i2;
}


if( item.head[ i ] != msg[ i2 ] ){
flag = false;
#ifdef _DEBUG
Expand Down

0 comments on commit 2f761b0

Please sign in to comment.