Skip to content

🐛 Fixed feature image alt text silently disappearing when too long - #29681

Merged
9larsons merged 1 commit into
TryGhost:mainfrom
suhailopensource:fix/29623-feature-image-alt-maxlength
Jul 30, 2026
Merged

9larsons merged 1 commit into
TryGhost:mainfrom
suhailopensource:fix/29623-feature-image-alt-maxlength

Conversation

@suhailopensource

Copy link
Copy Markdown
Contributor

Fixes #29623.

The feature image alt text field had no maxlength, so a user could type past the 191-character limit enforced by the server. Autosave runs with silent: true and the validation-error handler is gated on !options.silent, so the client validator failure was swallowed and no request was ever sent — the over-length text was then silently discarded on navigation.

Per @9larsons' guidance in the issue (impose the 191 limit rather than extend it, which would be a separate proposal), this adds maxlength="191" to the alt input so the unsaveable state can no longer be reached. The value matches the client validator (isLength {max: 191}) and server validation.

Notes for reviewers

  • maxlength counts UTF-16 units while the validator counts code points, so the field is very slightly stricter for emoji/astral characters — always the safe direction (anything the field allows still passes the server), so the bug cannot recur.
  • This guards new input. Pre-existing values over 191 (only creatable by bypassing model validation, since the column is VARCHAR(2000)) are not retro-trimmed, and the general silent: true swallow is untouched — consistent with the maintainer note that this "may need patching as well."

Test

Reproduced the issue on this branch (typing 192 chars → autosave silently drops it), then confirmed the fix: the field now hard-stops at 191, autosave succeeds, and nothing is lost on navigation.

fixes TryGhost#29623

- the feature image alt text field had no maxlength, so a user could type past the 191-character server limit
- autosave runs saveTask with silent: true and the catch that surfaces validation errors is gated on !options.silent, so the client validator failure was swallowed and no request was ever sent
- the over-length alt text was then silently discarded on navigation, with no error shown anywhere in the UI
- imposing the 191 limit on the field (per maintainer guidance to enforce rather than extend the limit) makes the unsaveable state unreachable, matching the client validator and server validation
@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bfca325f-0dde-4b71-afe3-558de700b6ef

📥 Commits

Reviewing files that changed from the base of the PR and between e1d00a5 and 82fc02e.

📒 Files selected for processing (1)
  • apps/ember-admin/app/components/gh-editor-feature-image.hbs

Walkthrough

The feature image alt-text input now includes a maxlength="191" attribute when editing alt text, matching the existing maximum length constraint.

Suggested reviewers: acburdine

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: constraining feature image alt text so long values no longer disappear.
Description check ✅ Passed The description is directly about the same alt-text maxlength fix and matches the changeset.
Linked Issues check ✅ Passed The change enforces the 191-character limit on the feature image alt input, matching the linked issue’s acceptance criteria.
Out of Scope Changes check ✅ Passed The diff only adds the 191 maxlength to the feature image alt input, with no unrelated changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@9larsons 9larsons 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.

Thanks.

@9larsons
9larsons enabled auto-merge (squash) July 30, 2026 12:42
@nx-cloud

nx-cloud Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 82fc02e

Command Status Duration Result
nx run @tryghost/admin:test:acceptance ✅ Succeeded 7m 9s View ↗
nx run-many -t test:unit -p @tryghost/admin ✅ Succeeded 3m 50s View ↗
nx run ghost-admin:test ✅ Succeeded 2m 45s View ↗
nx run @tryghost/admin:build ✅ Succeeded 1m 34s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 17s View ↗
nx run-many -t lint -p ghost-admin,@tryghost/ad... ✅ Succeeded 51s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-30 12:51:50 UTC

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.42%. Comparing base (e1d00a5) to head (82fc02e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #29681   +/-   ##
=======================================
  Coverage   75.42%   75.42%           
=======================================
  Files        1608     1608           
  Lines      141408   141408           
  Branches    17471    17471           
=======================================
  Hits       106654   106654           
  Misses      33683    33683           
  Partials     1071     1071           
Flag Coverage Δ
admin-tests 55.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@9larsons
9larsons merged commit 1938a05 into TryGhost:main Jul 30, 2026
45 checks passed
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.

Autosave silently discards feature image alt text over 191 characters and prevents leaving editor view

2 participants