fix: handle plain text descriptions in intake API#9181
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe intake view now imports HTML-escape and explicitly computes ChangesIntake Description HTML Escaping
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
apps/api/plane/api/views/intake.py
Description
This PR fixes how plain text descriptions are handled when creating intake issues through the API.
Previously, when
issue.descriptionwas provided as a plain string, it could be stored directly indescription_json, whiledescription_htmlremained 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_jsonfor structured descriptions and converts plain string descriptions into escaped HTML whendescription_htmlis not explicitly provided.Type of Change
Screenshots and Media (if applicable)
Test Scenarios
Tested intake issue creation through the API using only
name,description, andpriority.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 -->