Security: - Disable SSL verification only in development (lib/req.js) - Wrap all JSON.parse(cookie) calls in try-catch via safeJsonParse utility - Sanitize dangerouslySetInnerHTML in blog/clinic with sanitizeHtml utility - Fix open redirect in payment page — validate URL origin before redirect - Fix cookie cleanup on 401 — use js-cookie with correct domain scope Performance: - Wrap ItemDoctor with React.memo to prevent unnecessary re-renders - Replace <img> with Next.js <Image> in blog Caption component Functionality: - Fix memory leak in Recode.js — store intervals in refs, cleanup on unmount - Add null guard on retryIcon.current before classList manipulation - Fix getParsedUserInfo in helper to handle malformed cookie gracefully Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
901 B
JavaScript
31 lines
901 B
JavaScript
import React from "react";
|
|
import Image from "next/image";
|
|
import { sanitizeHtml } from "@/lib/sanitize";
|
|
|
|
function Caption({ data }) {
|
|
const imageUrl = data?.images?.[0]?.url;
|
|
|
|
return (
|
|
<>
|
|
{imageUrl && imageUrl.trim() !== "" && (
|
|
<div className="relative w-full aspect-video rounded-[8px] overflow-hidden">
|
|
<Image
|
|
src={imageUrl}
|
|
alt={data?.title || "blog cover"}
|
|
fill
|
|
className="object-cover"
|
|
/>
|
|
</div>
|
|
)}
|
|
{data?.body?.value && (
|
|
<div
|
|
className="my-[12px] sm:my-[16px] md:my-[20px] lg:my-[24px] text-[#525252] text-[14px] md:text-[15px] lg:text-[16px] font-normal leading-[26px] sm:leading-[28px] md:leading-[30px] lg:leading-[32px]"
|
|
dangerouslySetInnerHTML={{ __html: sanitizeHtml(data.body.value) }}
|
|
/>
|
|
)}
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default Caption;
|