OWASP / OWASP/Nest

[Cleanup] Resolve TODO: Remove image block handling in slack/utils.py

Open
#3,264 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
451
Forks
707
Avg merge
22h 59m
Merged PRs (30d)
91

Description

**Is your feature request related to a problem? Please describe.**
Yes. While auditing the Slack synchronization logic, I identified an 11-month-old technical debt in `backend/apps/slack/utils.py`. The `get_text` function currently handles "image" blocks by appending a raw URL string to the processed text. There is a TODO comment by @arkid15r on line 225 suggesting the removal of this case. Leaving this unaddressed leads to cluttered textual data in our database that may not align with the project's long-term data schema.

**Describe the solution you'd like**
I would like to refactor the `get_text` function in `backend/apps/slack/utils.py` by removing the `case "image"` block. This will ensure that the synced `Message` models contain only clean, textual conversation data, as currently defined in `apps/slack/models/message.py`.

**Describe alternatives you've considered**
An alternative would be to move image handling to a dedicated media synchronization service or store image metadata in a separate JSON field in the `Message` model. However, following the existing TODO to remove it from the plain-text parser seems to be the preferred direction for maintaining a clean string representation of Slack messages.

**Are you going to work on implementing this?**
- [x] Yes
- [ ] No

**Additional context**
The change involves removing the following logic:
```python
# TODO(arkid15r): consider removing this.
case "image":
text.append(f"Image: {block.get('image_url', '')}")

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.