[PR #79] [CLOSED] Fix: Handle empty post titles with consistent fallback #96

Closed
opened 2026-10-13 19:47:11 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Glitchy-Sheep/boosty-downloader/pull/79
Author: @schuigintou
Created: 12/13/2025
Status: ❌ Closed

Base: dev ← Head: fix/handle-empty-post-titles


📝 Commits (1)

  • 7c809a4 fix: 🐛 handle empty post titles with consistent fallback

📊 Changes

5 files changed (+14 additions, -5 deletions)

View changed files

📝 boosty_downloader/src/application/mappers/post_mapper.py (+1 -1)
📝 boosty_downloader/src/application/use_cases/check_total_posts.py (+5 -1)
📝 boosty_downloader/src/application/use_cases/download_all_posts.py (+1 -1)
📝 boosty_downloader/src/application/use_cases/download_specific_post.py (+6 -1)
📝 boosty_downloader/src/infrastructure/boosty_api/models/post/post.py (+1 -1)

📄 Description

📌 Fix: Handle empty post titles with consistent fallback

📝 Description

Posts with empty or missing title fields from the Boosty API were causing inconsistent behavior across different use cases (downloading, reporting, etc.), and triggering Pydantic validation errors when title was None.

This PR introduces a unified fallback mechanism that generates a consistent placeholder title using the post ID (first 8 characters) whenever the title is empty or missing. The fix is applied at multiple layers to ensure all parts of the application handle empty titles the same way.

Changes include:

  • Updated PostDTO model to allow title to be optional (str | None).
  • Modified the post_mapper to apply the fallback during domain object creation.
  • Applied the same fallback logic in download and reporting use cases for consistency.
  • Resolved the Pydantic validation error that occurred when title was None.

🔄 Changelog

  • 🛠 Fixed: Pydantic validation error when Boosty API returns null for post title.
  • 🔄 Changed: PostDTO.title field is now optional (str | None).
  • ✨ Added: Consistent fallback title generation ("Not title (id_{post_id[:8]})") across all use cases.
  • 🔄 Changed: Updated download_all_posts, download_specific_post, and check_total_posts use cases to use the same fallback logic.

Closes #78

✅ Checklist

  • Locally tested (make test and your own judgment)
  • Documentation updated (if necessary)
  • Code follows the project's style guidelines (make lint && make format)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Glitchy-Sheep/boosty-downloader/pull/79 **Author:** [@schuigintou](https://github.com/schuigintou) **Created:** 12/13/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/handle-empty-post-titles` --- ### 📝 Commits (1) - [`7c809a4`](https://github.com/Glitchy-Sheep/boosty-downloader/commit/7c809a4997efef42e2448c37e4285f2af9f6c8a8) fix: 🐛 handle empty post titles with consistent fallback ### 📊 Changes **5 files changed** (+14 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `boosty_downloader/src/application/mappers/post_mapper.py` (+1 -1) 📝 `boosty_downloader/src/application/use_cases/check_total_posts.py` (+5 -1) 📝 `boosty_downloader/src/application/use_cases/download_all_posts.py` (+1 -1) 📝 `boosty_downloader/src/application/use_cases/download_specific_post.py` (+6 -1) 📝 `boosty_downloader/src/infrastructure/boosty_api/models/post/post.py` (+1 -1) </details> ### 📄 Description # 📌 Fix: Handle empty post titles with consistent fallback ## 📝 Description Posts with empty or missing title fields from the Boosty API were causing inconsistent behavior across different use cases (downloading, reporting, etc.), and triggering Pydantic validation errors when title was None. This PR introduces a unified fallback mechanism that generates a consistent placeholder title using the post ID (first 8 characters) whenever the title is empty or missing. The fix is applied at multiple layers to ensure all parts of the application handle empty titles the same way. **Changes include:** - Updated `PostDTO` model to allow `title` to be optional (`str | None`). - Modified the `post_mapper` to apply the fallback during domain object creation. - Applied the same fallback logic in download and reporting use cases for consistency. - Resolved the Pydantic validation error that occurred when `title` was `None`. ## 🔄 Changelog - **🛠 Fixed:** Pydantic validation error when Boosty API returns `null` for post title. - **🔄 Changed:** `PostDTO.title` field is now optional (`str | None`). - **✨ Added:** Consistent fallback title generation (`"Not title (id_{post_id[:8]})"`) across all use cases. - **🔄 Changed:** Updated `download_all_posts`, `download_specific_post`, and `check_total_posts` use cases to use the same fallback logic. ## 🎯 Related Issue Closes #78 ## ✅ Checklist - [x] Locally tested (`make test` and your own judgment) - [x] Documentation updated (if necessary) - [x] Code follows the project's style guidelines (`make lint && make format`) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-13 19:47:11 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Glitchy-Sheep/boosty-downloader#96
No description provided.