@rspress-theme-anatole/theme-default 0.7.50 → 0.7.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bundle.js +18 -6
  2. package/package.json +3 -3
package/dist/bundle.js CHANGED
@@ -7510,9 +7510,15 @@ async function exportProductToPdf(siteData, lang) {
7510
7510
  let filename = `${parts[1] || 'product'}.pdf`;
7511
7511
 
7512
7512
  if (contentDisposition) {
7513
- const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);
7514
- if (matches?.[1]) {
7515
- filename = matches[1].replace(/['"]/g, '');
7513
+ // Prefer filename*= (RFC 5987) which carries the properly percent-encoded Unicode name
7514
+ const starMatch = /filename\*\s*=\s*UTF-8''([^;\n]+)/i.exec(contentDisposition);
7515
+ if (starMatch?.[1]) {
7516
+ filename = decodeURIComponent(starMatch[1]);
7517
+ } else {
7518
+ const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);
7519
+ if (matches?.[1]) {
7520
+ filename = matches[1].replace(/['"]/g, '');
7521
+ }
7516
7522
  }
7517
7523
  }
7518
7524
 
@@ -7578,9 +7584,15 @@ async function exportPageToPDF(siteData, lang) {
7578
7584
  let filename = validDocumentPath.split('/').pop().replace(/\.(md|mdx)$/, '.pdf');
7579
7585
 
7580
7586
  if (contentDisposition) {
7581
- const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);
7582
- if (matches?.[1]) {
7583
- filename = matches[1].replace(/['"]/g, '');
7587
+ // Prefer filename*= (RFC 5987) which carries the properly percent-encoded Unicode name
7588
+ const starMatch = /filename\*\s*=\s*UTF-8''([^;\n]+)/i.exec(contentDisposition);
7589
+ if (starMatch?.[1]) {
7590
+ filename = decodeURIComponent(starMatch[1]);
7591
+ } else {
7592
+ const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);
7593
+ if (matches?.[1]) {
7594
+ filename = matches[1].replace(/['"]/g, '');
7595
+ }
7584
7596
  }
7585
7597
  }
7586
7598
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rspress-theme-anatole/theme-default",
3
3
  "author": "Anatole Tong",
4
- "version": "0.7.50",
4
+ "version": "0.7.51",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
7
7
  "*.css",
@@ -21,8 +21,8 @@
21
21
  "types": "./dist/bundle.d.ts",
22
22
  "dependencies": {
23
23
  "@mdx-js/react": "2.3.0",
24
- "@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.50",
25
- "@rspress-theme-anatole/shared": "0.7.50",
24
+ "@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.51",
25
+ "@rspress-theme-anatole/shared": "0.7.51",
26
26
  "@rspress/runtime": "1.43.8",
27
27
  "body-scroll-lock": "4.0.0-beta.0",
28
28
  "copy-to-clipboard": "^3.3.3",