Skip to content

fix: reddit settings type only accepts self, link, media - #1915

Merged
giladresisi merged 1 commit into
mainfrom
fix/reddit-type-values
Sep 15, 2026
Merged

giladresisi merged 1 commit into
mainfrom
fix/reddit-type-values

Conversation

@giladresisi

@giladresisi giladresisi commented Aug 18, 2026 •

Copy link
Copy Markdown
Collaborator

What kind of change does this PR introduce?

Bug fix (backend DTO + frontend, Reddit settings). Constrains RedditSettingsDtoInner.type to @IsIn(['self', 'link', 'media']) instead of @MinLength(2), corrects its @JSONSchema description to describe what those three values actually do, and seeds url: '' when a subreddit is added in subreddit.tsx so the field always exists. Flag for the reviewer: RedditProvider still maps image, video and videogif as valid kinds, so existing drafts and public-API callers using those values would start failing validation - they should be added to the IsIn list. The url: '' seed also makes @IsUrl() fire immediately on subreddits that only allow link posts, where it was previously skipped.

Why was this change needed?

The Reddit settings DTO advertised type as "link, self, image, video, videogif", but the provider only implements self, link and media (upload the post's first attached image or mp4). Any other value was forwarded to Reddit as kind without a file, so image / video posts always failed at publish time with Reddit's BAD_URL "The image URL can't be empty". A customer creating Reddit posts through the public API hit this for weeks with every post failing.

Now:

  • type is validated with @IsIn(['self', 'link', 'media']), so unknown values fail with a 400 at request time instead of silently failing at Reddit.
  • The JSON schema description (what the public API and MCP integrationSchema expose) lists the real values.
  • The composer initialises url to '' when a subreddit is picked, so the URL input is controlled from mount (removes a React "uncontrolled to controlled" console error) and an empty link URL is now validated.

Note: text (used by the old postiz-agent skill; it fell back to self) is now rejected. Companion PRs update the docs and the agent skill:

Those two should only be merged after this PR is deployed to production.

Other information:

Tested:

  • Public API: type: image and type: text return 400 mentioning type; self and link (with url) are accepted; media with an attached PNG published successfully to a real Reddit channel.
  • Public API integration schema shows the new description.
  • Composer: Post, Link and Media types validate and save; the URL input console error is gone.

QA

  1. Create a Reddit post and add a subreddit that allows both self and link posts
  2. Set the post type to each of self, link and media in turn and save - all three are accepted
  3. POST a Reddit post through the public API with "type": "banana" - returns 400 naming the allowed values
  4. POST a Reddit post through the public API with "type": "image" - confirm whether the 400 is intended, because this succeeds today
  5. Add a subreddit that only allows link posts and confirm the URL field validation behaves sensibly with the new empty-string seed
  6. Publish one self post and one link post end to end to confirm nothing regressed

Checklist:

  • I have read the CONTRIBUTING guide.
  • I have signed the Contributor License Agreement (CLA) (ICLA for individuals, CCLA for entities).
  • I confirm I have not used AI to submit this PR or generate code for it.
  • I checked that there were no similar issues or PRs already open for this.
  • This PR fixes just ONE issue

🤖 Generated with Claude Code

The Reddit DTO advertised type as link/self/image/video/videogif, but the
provider only implements self, link and media (upload the first attached
file). Other values were forwarded to Reddit as kind without a file and
always failed with BAD_URL. Validate type with @isin and fix the public
API / MCP schema description.

Also initialise url to '' when a subreddit is picked in the composer, so
the URL input is controlled from mount (fixes the React uncontrolled to
controlled warning) and empty link URLs are validated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@postiz-contribution
postiz-contribution Bot changed the base branch from main to staging August 18, 2026 09:49
@strix-security

strix-security Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Strix Security Review

No security issues found.

Updated for 5d3acd7.


Reviewed by Strix
Re-run review · Configure security review settings

@postiz-agent

postiz-agent Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@postiz-contribution
postiz-contribution Bot changed the base branch from staging to main September 15, 2026 08:20
@giladresisi
giladresisi added this pull request to the merge queue Sep 15, 2026
Merged via the queue into main with commit 79963b5 Sep 15, 2026
13 checks passed
@giladresisi
giladresisi deleted the fix/reddit-type-values branch September 15, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant