Update: relative post_id

This commit is contained in:
hyzen
2026-06-26 13:24:24 +02:00
parent a15bcedac1
commit a21e5f64ed

View File

@@ -273,6 +273,12 @@ if ($action === 'post' || $action === 'reply') {
if ($post_id === '') {
json_out(['success' => false, 'message' => 'post_id is required.']);
}
// post_id should always be a site-relative path like "/blog/some-post/".
// Reject anything else here, before it can shape outgoing notification
// email content or anything else downstream.
if (!preg_match('#^/[a-zA-Z0-9_/-]{1,200}/$#', $post_id)) {
json_out(['success' => false, 'message' => 'Invalid post_id.']);
}
if ($text === '') {
json_out(['success' => false, 'message' => 'Comment cannot be empty.']);
}