close
Skip to content

fix: handle plain text descriptions in intake API#9181

Open
Danielllira wants to merge 2 commits into
makeplane:previewfrom
Danielllira:fix/intake-plain-description
Open

fix: handle plain text descriptions in intake API#9181
Danielllira wants to merge 2 commits into
makeplane:previewfrom
Danielllira:fix/intake-plain-description

Conversation

@Danielllira
Copy link
Copy Markdown

@Danielllira Danielllira commented May 31, 2026

Description

This PR fixes how plain text descriptions are handled when creating intake issues through the API.

Previously, when issue.description was provided as a plain string, it could be stored directly in description_json, while description_html remained as the default empty paragraph (<p></p>). As a result, the description was saved but not rendered correctly in the Plane UI.

This change keeps description_json for structured descriptions and converts plain string descriptions into escaped HTML when description_html is not explicitly provided.

Type of Change

  • [ x ] Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

Tested intake issue creation through the API using only name, description, and priority.

Example payload:

{
  "issue": {
    "name": "Test via API",
    "description": "Request created through the API",
    "priority": "medium"
  }
}

### References
https://github.com/makeplane/plane/issues/9180

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **Bug Fixes**
  * Plain-text issue descriptions are now safely escaped and wrapped as sanitized HTML.
  * Description fields follow clear precedence: structured JSON is used when present; otherwise plain-text is converted appropriately.
  * Empty or missing HTML descriptions default to a safe empty paragraph to prevent accidental rendering issues.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7b4dcf85-d2e3-47c5-ada3-0b58896fea1e

📥 Commits

Reviewing files that changed from the base of the PR and between ec8fb21 and 4846643.

📒 Files selected for processing (1)
  • apps/api/plane/api/views/intake.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/api/plane/api/views/intake.py

📝 Walkthrough

Walkthrough

The intake view now imports HTML-escape and explicitly computes description_json (only from provided JSON or dict/list) and description_html (defaults to <p></p> or an escaped <p>{text}</p> when needed) before calling Issue.objects.create().

Changes

Intake Description HTML Escaping

Layer / File(s) Summary
Intake description escaping and HTML generation
apps/api/plane/api/views/intake.py
Adds escape import and rewrites creation logic so description_json is taken only from explicit description_json (or from description when it's a dict/list), and description_html defaults to <p></p> or is generated by escaping and wrapping plain-text description when description_html is not provided.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #9180: Addresses the case where plain-text description strings were being stored into description_json and lacked HTML escaping.

Poem

🐰 I hop through payloads neat and bright,
Escaping text to keep HTML right,
JSON stays JSON, HTML is wrapped,
No raw strings accidentally trapped,
Intake earns a tidy bite of light.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing how plain text descriptions are handled in the intake API.
Description check ✅ Passed The description includes a detailed explanation of the bug, the solution, the type of change, and test scenarios with an example payload. Screenshots and references sections are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 31, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/api/plane/api/views/intake.py`:
- Around line 190-192: The code currently uses description_json =
issue_data.get("description_json") or {} which will replace explicit falsy
values (e.g., [] or "") with {}, losing client input; change this to explicitly
check for the presence of the key: if "description_json" in issue_data:
description_json = issue_data["description_json"] else: description_json = {} so
explicit falsy values are preserved, and keep the subsequent conditional that
assigns description_json = description only when "description_json" is not in
issue_data and description is a dict or list; refer to the description_json
variable, the issue_data dict access, and the description variable to locate the
logic to update.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9b74dcde-ea9c-4bb2-8c3f-e13dcc921293

📥 Commits

Reviewing files that changed from the base of the PR and between 04622ce and ec8fb21.

📒 Files selected for processing (1)
  • apps/api/plane/api/views/intake.py

Comment thread apps/api/plane/api/views/intake.py Outdated
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.

2 participants