Skip to content

[Bug]: Viewer export filenames drop non-Latin diagram titles (every zh/ko/ru export is "diagram.png") #1024

Open

Description

@rudycelekli

Archify version or commit: e6048f5c887572f39a9cc0a77fb4c5b4c96015b7

Installation method: Git clone

Diagram type: Generated viewer

Exact command: this runs the shipped diagramFilename() from viewer/export.js in Node with a stub document. In the Viewer, the equivalent is to render any diagram with a CJK or Cyrillic meta.title and use Export → PNG/SVG or a share card.

cat > fname.mjs <<'EOF'
import fs from 'node:fs';
const src = fs.readFileSync(process.argv[2], 'utf8');
const body = src.slice(src.indexOf('function diagramFilename()'), src.indexOf('function currentBg()'));
for (const title of ['订单平台','Checkout Platform Diagram','Checkout 다이어그램','Pagos · Diagrama','Сервис оплаты','Zahlungsübersicht Diagram'])
  console.log(JSON.stringify(title), '->', new Function('document', body + '; return diagramFilename();')({ title }));
EOF
node fname.mjs $REPO/viewer/export.js

Minimal redacted JSON reproduction: not JSON-driven. The input is document.title, which comes from the page.title locale template (zh-CN/zh-TW: {title}, ko: {title} 다이어그램, es: {title} · Diagrama, en: {title} Diagram). The steps above are the reproduction.

Validation receipt or exact error: no error. Output:

"订单平台" -> diagram
"Checkout Platform Diagram" -> checkout-platform
"Checkout 다이어그램" -> checkout
"Pagos · Diagrama" -> pagos-diagrama
"Сервис оплаты" -> diagram
"Zahlungsübersicht Diagram" -> zahlungs-bersicht

Expected behavior

  • The exported filename keeps the diagram title in every locale Archify ships.
  • Locale suffixes are stripped consistently: the English "Diagram" is removed, but Spanish "Diagrama" stays in the name.
  • Accented letters such as "ü" do not split a word.

Actual behavior: viewer/export.js:34-42 replaces every character outside [a-z0-9_-] with -, so an all-CJK or all-Cyrillic title collapses to the fallback diagram. Every PNG, SVG and share card from such diagrams downloads as diagram.* / diagram-route-share-card.png, so successive downloads collide. The callers are at export.js:1205, :1258 and :1282.

Environment: macOS 27.0.1, Node.js 22.19.0 (logic run in Node; not observed in a browser download), Claude Code, Claude Opus 5.5

Related: #733 / #874 (exports in claude.ai Artifact hosts) do not touch filename derivation.

AI assistance and origin

Origin: reproducible defect found during code inspection, reproduced with a minimal synthetic input. It is not reported from production usage. Investigation, reproduction and writing were done with AI assistance (Claude Code, model Claude Opus 5.5) for @rudycelekli, who is the accountable contributor. This does not claim human review or maintainer scope agreement. No fix or PR has been started; I am asking whether the fix is in scope before any implementation.

Final checks

  • I searched existing issues and PRs (see Related).
  • The reproduction is synthetic and contains no secrets, private repository content or personal data.

Activity

  1. BlueboxC commented on Oct 20, 2026

    @BlueboxC

    Implemented Unicode-safe export names from the authored .header h1, normalized to NFC and restricted to letters/marks/numbers plus safe separators. This avoids appending translated page suffixes and preserves an authored title ending in “Diagram”. Browser downloads cover CJK, Japanese, Arabic, decomposed accents, unsafe characters and the legitimate Diagram suffix. All 24 final export checks pass; these final heading refinements were tested after the earlier full-suite run.

    Applied to our Archify 3.2.0 fork and installed Skill: verified commit. The correction batch passes 3,400 full-suite tests (126 conditional skips), the maintained Chrome gate (311 passes, seven conditional skips), WebM and extracted/installed package smokes. All 39 Timeline/Waterfall regressions also pass against the installed renderers. All 213 installed managed files match the package by hash/mode; existing customizations are preserved. Automated checks do not replace perceptual review, and this does not imply upstream acceptance.

    BlueboxC

  2. tt-a1i commented on Oct 25, 2026

    @tt-a1i
    Owner

    Partial completion update: #1039 is now merged into dev through #1102 (10b4dd5). Unicode letters/marks/numbers and accented titles are preserved instead of collapsing to diagram. The existing English suffix behavior is retained; consistent localized suffix stripping remains outside this implementation. Keeping this issue open for that remaining acceptance item.

  3. tt-a1i commented on Oct 25, 2026

    @tt-a1i
    Owner

    Follow-up scope for the remaining item: Unicode preservation is already delivered through #1039/#1102. Please propose a small way to derive the authored title consistently, removing only generated locale decorations while preserving a legitimate authored title ending in “Diagram” or a translated equivalent. Specify a fallback for older/custom pages before implementation; avoid stripping arbitrary matching words from authored content.

    Keep Unicode-safe sanitization and current format/share-card naming. A focused comparison across the English, Spanish, Korean, Arabic and Chinese page-title templates, literal suffix-like titles and fallback pages, with real download coverage for affected callers, is sufficient. This does not request a general locale/RTL or export redesign. The existing fork's heading-based approach is useful evidence, not an adopted upstream implementation.

  4. BlueboxC commented on Oct 25, 2026

    @BlueboxC

    Proposed title policy, implemented and verified in our fork: prefer the authored .header h1 for generated Viewer pages, so locale-specific document-title decoration never enters the filename. For older/custom pages without that heading, preserve the complete document.title; when both are empty, use diagram. A legacy page provides no reliable way to distinguish an authored “Diagram” from generated decoration, so the fallback deliberately avoids guessing.

    Our earlier heading-based implementation already covered ordinary generated pages, but its heading-less fallback still stripped suffix-like authored words. 383f3f3 removes that ambiguity while retaining NFC/Unicode-safe sanitization and current format/share-card suffixes.

    A real Chrome filesystem-download regression first reproduced Checkout Diagram becoming checkout-dark.svg on the fallback path. After the fix, 13 actual downloads pass across English, Spanish, Korean, Arabic and Chinese: generated headings, literal suffix-like fallback titles, light/dark SVG, PNG, route-share-card naming and the empty-title default. Reproduce with ARCHIFY_CHROME=/path/to/chrome node --test test/export-filename-fallback-browser.test.mjs at the linked commit.

    The final package is installed and all 213 managed hashes/modes verified; the same downloads also pass against the installed Skill. Combined package qualification: 3,478 full-suite passes / 134 conditional skips; 315 maintained Chrome passes / 10 conditional skips; all 25 additional export tests pass. This supplies a small candidate policy and evidence, not a claim that upstream has adopted it or a general locale/RTL redesign.

    BlueboxC

  5. tt-a1i commented on Oct 26, 2026

    @tt-a1i
    Owner

    Agent-assisted maintenance follow-up.

    Thanks, this answers the remaining title-policy question. Agreed: use the authored .header h1 on generated Viewer pages; if that heading is absent or blank, preserve the complete document.title; use diagram only when both are empty. Do not strip suffix-like words from authored or fallback titles. Keep Unicode-safe sanitization and the current format/share-card suffixes.

    Please bring this as a focused contribution against current dev, retaining attribution to the fork candidate. The supplied five-locale, literal-title and heading-less download comparison covers the requested cases; reuse it at its tested revision and verify the affected callers on the submitted head. Those downloads are author-provided evidence, not independently rerun in this review. No general locale/RTL or export redesign is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions