[PR #98] [MERGED] Handle posts with missing or empty titles gracefully #107

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

📋 Pull Request Information

Original PR: https://github.com/Glitchy-Sheep/boosty-downloader/pull/98
Author: @Glitchy-Sheep
Created: 4/11/2026
Status: ✅ Merged
Merged: 4/11/2026
Merged by: @Glitchy-Sheep

Base: main ← Head: fix/title-validation-fail


📝 Commits (2)

  • 4d159b1 Handle posts with missing or empty titles gracefully
  • c05b8f6 Ruff format

📊 Changes

3 files changed (+16 additions, -2 deletions)

View changed files

📝 boosty_downloader/src/application/use_cases/download_all_posts.py (+1 -1)
📝 boosty_downloader/src/application/use_cases/download_specific_post.py (+5 -1)
📝 boosty_downloader/src/infrastructure/boosty_api/models/post/post.py (+10 -0)

📄 Description

Fix posts with missing or empty titles causing validation errors

📝 Description

Boosty posts have null title in the API response when the title is empty (instead of empty string), which causes Pydantic validation errors when parsing the post data.

This PR adds defensive handling at two levels:

  1. DTO layer - a Pydantic field_validator converts None title to an empty string, preventing validation failures
  2. Use case layer - both bulk and single-post download now consistently apply a "No title (id_...)" fallback for posts with empty titles

🔄 Changelog

  • 🛠 Fixed: Pydantic validation error when API returns null for post title
  • 🛠 Fixed: Single-post download creating broken folder names for untitled posts
  • 🛠 Fixed: Typo in fallback title text ("Not title" → "No title")

Closes #79

✅ 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/98 **Author:** [@Glitchy-Sheep](https://github.com/Glitchy-Sheep) **Created:** 4/11/2026 **Status:** ✅ Merged **Merged:** 4/11/2026 **Merged by:** [@Glitchy-Sheep](https://github.com/Glitchy-Sheep) **Base:** `main` ← **Head:** `fix/title-validation-fail` --- ### 📝 Commits (2) - [`4d159b1`](https://github.com/Glitchy-Sheep/boosty-downloader/commit/4d159b1459099a7ddfbc88c0bbb9490a2aa217da) Handle posts with missing or empty titles gracefully - [`c05b8f6`](https://github.com/Glitchy-Sheep/boosty-downloader/commit/c05b8f6ef03f777318e8e71490c79f46a78d03b8) Ruff format ### 📊 Changes **3 files changed** (+16 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `boosty_downloader/src/application/use_cases/download_all_posts.py` (+1 -1) 📝 `boosty_downloader/src/application/use_cases/download_specific_post.py` (+5 -1) 📝 `boosty_downloader/src/infrastructure/boosty_api/models/post/post.py` (+10 -0) </details> ### 📄 Description # Fix posts with missing or empty titles causing validation errors ## 📝 Description Boosty posts have `null` title in the API response when the title is empty (instead of empty string), which causes Pydantic validation errors when parsing the post data. This PR adds defensive handling at two levels: 1. **DTO layer** - a Pydantic `field_validator` converts `None` title to an empty string, preventing validation failures 2. **Use case layer** - both bulk and single-post download now consistently apply a `"No title (id_...)"` fallback for posts with empty titles ## 🔄 Changelog - **🛠 Fixed:** Pydantic validation error when API returns `null` for post title - **🛠 Fixed:** Single-post download creating broken folder names for untitled posts - **🛠 Fixed:** Typo in fallback title text ("Not title" → "No title") ## 🎯 Related Issue Closes #79 ## ✅ 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:24 +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#107
No description provided.