Skip to content

fix(app): limit export filename length - #54726

Closed
kpdagrt22 wants to merge 2 commits into
anomalyco:devfrom
kpdagrt22:export-name-v2
Closed

kpdagrt22 wants to merge 2 commits into
anomalyco:devfrom
kpdagrt22:export-name-v2

Conversation

@kpdagrt22

@kpdagrt22 kpdagrt22 commented Oct 12, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #54721

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

sessionExportFilename had no length cap, so a long session title produced an unsavable filename over the 255-byte limit. Caps the sanitized ASCII basename at 250 chars, leaving room for .json.

How did you verify your code works?

Confirmed a 300-char title now yields a 255-byte filename. Added a regression test asserting the capped name and length.

Screenshots / recordings

N/A - logic change, no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix works. Calling sessionExportFilename with a 300-character title gives a 305-byte filename on the base and 255 bytes with this change. export.test.ts and the app package's typecheck both pass.

Public API: unchanged. The change is internal to the web app's export filename helper.

One small thing: when the 250-character cut lands just after a hyphen, the name keeps a trailing - (see the inline comment).

.replace(/^-+|-+$/g, "")
// The sanitized basename is ASCII-only, so capping characters keeps the
// filename within the 255-byte filesystem component limit with ".json".
.slice(0, 250)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The leading/trailing hyphen trim on line 43 runs before this cut, so a cut that lands right after a separator leaves a trailing -. For example, a title of "a".repeat(249) + " bcd" exports as aaa…a-.json. Moving .slice(0, 250) above the .replace(/^-+|-+$/g, "") (or trimming again after it) keeps names clean.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Long session titles produce unsavable export filenames

1 participant