Compare commits

...
2 Commits
Author SHA1 Message Date
alam00000 32ba24782f Release v2.3.1 2026-02-21 14:27:59 +05:30
alam00000 a119837c8a fix: improve error handling in performCondenseCompression function
fix: routing
2026-02-21 14:27:53 +05:30
4 changed files with 17 additions and 19 deletions

No files matched your search

+2 -2
View File
@@ -84,7 +84,7 @@ http {
add_header Cache-Control "public, immutable"; add_header Cache-Control "public, immutable";
} }
location ~ ^/(en|de|es|zh|zh-TW|vi|it|id|tr|fr|pt|be)(/.*)?$ { location ~ ^/(en|ar|be|da|de|es|fr|id|it|nl|pt|tr|vi|zh|zh-TW)(/.*)?$ {
try_files $uri $uri/ $uri.html /$1/index.html /index.html; try_files $uri $uri/ $uri.html /$1/index.html /index.html;
expires 5m; expires 5m;
add_header Cache-Control "public, must-revalidate"; add_header Cache-Control "public, must-revalidate";
@@ -92,7 +92,7 @@ http {
add_header Cross-Origin-Opener-Policy "same-origin" always; add_header Cross-Origin-Opener-Policy "same-origin" always;
} }
location ~ ^/(.+?)/(en|de|es|zh|zh-TW|vi|it|id|tr|fr|pt|be)(/.*)?$ { location ~ ^/(.+?)/(en|ar|be|da|de|es|fr|id|it|nl|pt|tr|vi|zh|zh-TW)(/.*)?$ {
try_files $uri $uri/ $uri.html /$1/$2/index.html /$1/index.html /index.html; try_files $uri $uri/ $uri.html /$1/$2/index.html /$1/index.html /index.html;
expires 5m; expires 5m;
add_header Cache-Control "public, must-revalidate"; add_header Cache-Control "public, must-revalidate";
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "bento-pdf", "name": "bento-pdf",
"private": true, "private": true,
"version": "2.3.0", "version": "2.3.1",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"type": "module", "type": "module",
"scripts": { "scripts": {
+5 -8
View File
@@ -83,12 +83,7 @@ export async function performCondenseCompression(
try { try {
const result = await pymupdf.compressPdf(fileBlob, options); const result = await pymupdf.compressPdf(fileBlob, options);
return result; return result;
} catch (error: any) { } catch {
const errorMessage = error?.message || String(error);
if (
errorMessage.includes('PatternType') ||
errorMessage.includes('pattern')
) {
const fallbackOptions = { const fallbackOptions = {
...options, ...options,
images: { images: {
@@ -97,11 +92,13 @@ export async function performCondenseCompression(
}, },
}; };
try {
const result = await pymupdf.compressPdf(fileBlob, fallbackOptions); const result = await pymupdf.compressPdf(fileBlob, fallbackOptions);
return { ...result, usedFallback: true }; return { ...result, usedFallback: true };
} catch (fallbackError: any) {
const msg = fallbackError?.message || String(fallbackError);
throw new Error(`PDF compression failed: ${msg}`);
} }
throw new Error(`PDF compression failed: ${errorMessage}`);
} }
} }
+9 -8
View File
@@ -14,19 +14,20 @@ import type { OutputBundle } from 'rollup';
const SUPPORTED_LANGUAGES = [ const SUPPORTED_LANGUAGES = [
'en', 'en',
'ar',
'be', 'be',
'da',
'de', 'de',
'es', 'es',
'fr',
'id',
'it',
'nl',
'pt',
'tr',
'vi',
'zh', 'zh',
'zh-TW', 'zh-TW',
'vi',
'it',
'id',
'tr',
'fr',
'pt',
'nl',
'da',
] as const; ] as const;
const LANG_REGEX = new RegExp( const LANG_REGEX = new RegExp(
`^/(${SUPPORTED_LANGUAGES.join('|')})(?:/(.*))?$` `^/(${SUPPORTED_LANGUAGES.join('|')})(?:/(.*))?$`