fix(together): アーカイブSQL構文エラー修正(JS側でホスト名判定に変更)

This commit is contained in:
posimai 2026-04-22 12:54:58 +09:00
parent 5d1b6dfb2b
commit 4f6be0a21e
1 changed files with 7 additions and 8 deletions

View File

@ -2632,17 +2632,16 @@ ${excerpt}
} }
} catch (_) {} } catch (_) {}
// x.com など既存タイトルがドメイン名のみの場合は Jina タイトルで上書き // 既存タイトルがドメイン名のみの場合は Jina タイトルで上書きJS 側で判定)
let hostname = '';
try { hostname = new URL(url).hostname.replace('www.', ''); } catch (_) {}
const titleOverwrite = jinaTitle && hostname && jinaTitle !== hostname;
await pool.query( await pool.query(
`UPDATE together_shares `UPDATE together_shares
SET full_content=$1, SET full_content=$1,
title=CASE title=CASE WHEN title IS NULL OR ($2::boolean AND title=$3::text) THEN $4::text ELSE title END
WHEN title IS NULL THEN $2::text WHERE id=$5`,
WHEN $2::text IS NOT NULL AND title = regexp_replace($3::text, '^https?://(www\.)?([^/]+).*$', '\2') THEN $2::text [fullContent, titleOverwrite, hostname, jinaTitle, shareId]
ELSE title
END
WHERE id=$4`,
[fullContent, jinaTitle, url, shareId]
); );
function parseGeminiJson(raw) { function parseGeminiJson(raw) {