Add reusable social preview image and metadata - #7
Conversation
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
PR Summary by QodoAdd social preview image and Open Graph/Twitter metadata
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. Invalid OG image dimensions
|
|
| <meta property="og:image:width" content="<?php echo (int) $socialImageWidth; ?>"> | ||
| <meta property="og:image:height" content="<?php echo (int) $socialImageHeight; ?>"> |
There was a problem hiding this comment.
1. Invalid og image dimensions 🐞 Bug ≡ Correctness
$socialImageWidth/$socialImageHeight are output as integers without validating they are positive, so a non-null but invalid override (e.g., empty string) bypasses the ?? defaults and can emit 0/invalid og:image:width/height metadata. This can cause social parsers to ignore or mis-handle the image dimensions for pages that override these values incorrectly.
Agent Prompt
## Issue description
`$socialImageWidth` and `$socialImageHeight` are emitted as integers but are not validated to be positive integers. Because the defaults use `??`, any non-null invalid value (e.g., `''`, `false`, `'abc'`) will bypass the default and then be cast to `0`, producing invalid Open Graph dimension metadata.
## Issue Context
Pages currently don’t override these variables, but the PR explicitly makes them overridable. Defensive validation prevents future callers/config from unintentionally emitting invalid metadata.
## Fix Focus Areas
- includes/header.php[10-13]
- includes/header.php[29-31]
## Suggested change
Before emitting the meta tags, normalize the values to positive ints (fallback to 1200/630 when invalid), e.g.:
- If `!is_int($socialImageWidth)`/`!ctype_digit((string)$socialImageWidth)` or `(int)$socialImageWidth <= 0`, set to `1200`
- Same for height with `630`
Keep the `(int)` cast in output after validation.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit fceae22 |



What changed
assets/img/librtmp2Rust library from the self-hosted server and panel in the artwork$socialImage, dimensions, and alt-text defaults inincludes/header.phpValidation
php -l includes/header.php/quickstart/, and/guides/self-hosted-rtmp-server-docker/Closes #3
Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.