Changes made as recommended by Claude:

1. Added a request timeout to prevent server resources from being tied up (route.ts)
2. Implemented runtime validation for the API response shape (url-utils.ts)
3. Removed hardcoded English error messages and replaced them with localized strings (url-input-dialog.tsx)
4. Fixed the incorrect i18n namespace (changed from pdf.* to url.*) (url-input-dialog.tsx and en/ja/zh.json)
This commit is contained in:
Biki Kalita
2026-01-05 14:51:24 +05:30
parent 64268b0fac
commit 580d42f535
8 changed files with 1625 additions and 55 deletions

View File

@@ -60,9 +60,9 @@ export function UrlInputDialog({
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="sm:max-w-md">
<DialogHeader>
<DialogTitle>{dict.pdf.title}</DialogTitle>
<DialogTitle>{dict.url.title}</DialogTitle>
<DialogDescription>
{dict.pdf.description}
{dict.url.description}
</DialogDescription>
</DialogHeader>
@@ -91,7 +91,7 @@ export function UrlInputDialog({
onClick={() => onOpenChange(false)}
disabled={isExtracting}
>
{dict.pdf.Cancel}
{dict.url.Cancel}
</Button>
<Button
onClick={handleSubmit}
@@ -100,12 +100,12 @@ export function UrlInputDialog({
{isExtracting ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
{dict.pdf.Extracting}
{dict.url.Extracting}
</>
) : (
<>
<Link className="mr-2 h-4 w-4" />
{dict.pdf.extract}
{dict.url.extract}
</>
)}
</Button>