From 2f761b08330f77d06971247b383e761f0627ed27 Mon Sep 17 00:00:00 2001 From: jd Fedora maintainer Date: Sat, 12 Aug 2023 13:01:57 +0900 Subject: [PATCH] Log_Manager::check_write: skip heading continuous newlines for early-check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 先頭に空白行が連続する書き込みをすると、5chの仕様ではそれらを 削除したものが帰ってくるので、Log_Manager::check_write で 簡易チェックをするとき、先頭の連続する改行は読み飛ばす 不具合報告: https://next2ch.net/test/read.cgi/linux/1654053581/112-113 --- src/message/logmanager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/message/logmanager.cpp b/src/message/logmanager.cpp index 64257ffe2..be5de15ea 100644 --- a/src/message/logmanager.cpp +++ b/src/message/logmanager.cpp @@ -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