Skip to content

Fix bugs and code quality issues from code review#3

Merged
antfred merged 1 commit intomasterfrom
code-review-fixes
Apr 6, 2026
Merged

Fix bugs and code quality issues from code review#3
antfred merged 1 commit intomasterfrom
code-review-fixes

Conversation

@antfred
Copy link
Copy Markdown
Owner

@antfred antfred commented Apr 6, 2026

Summary

  • Bug fix: `rename` crashed by calling `find_feed` after the folder was already moved
  • Bug fix: `episode_too_old` compared UTC `now` against local-time `fromtimestamp`
  • Bug fix: `download_single` raised `KeyError` when server omits `Content-Length` header
  • Bug fix: `pretty_print_feeds` raised `IndexError` on feeds with no episodes
  • Reliability: Replaced bare `except` with specific `(KeyError, IndexError)` in `download_single`
  • Refactor: Extracted `_make_feed_folder` to eliminate duplicated folder-creation logic
  • Performance: Replaced O(n²) nested loop in `update_feed` with O(1) set-based deduplication
  • Cleanup: Removed unused `mimetypes` list; removed redundant `hasattr` check
  • Fix: Added missing `exit(0)` after `rename` command in `main`

Test plan

  • `podfox import ` works with and without a shortname
  • `podfox update` adds new episodes without duplicates
  • `podfox download` works when server omits `Content-Length`
  • `podfox rename ` renames correctly and updates `feed.json`
  • `podfox feeds` displays correctly for feeds with zero downloaded episodes
  • `podfox prune` age filtering is consistent regardless of local timezone

- Remove unused top-level mimetypes list
- Fix timezone bug in episode_too_old: use utcfromtimestamp instead of fromtimestamp
- Extract _make_feed_folder helper to deduplicate folder creation logic in import_feed
- Replace O(n²) nested loop in update_feed with O(1) set-based deduplication
- Remove redundant hasattr check in episodes_from_feed
- Replace bare except with specific (KeyError, IndexError) in download_single
- Fix Content-Length KeyError in download_single by using headers.get with fallback
- Fix rename crash: call find_feed before os.rename so the feed file can still be found
- Guard against empty episode list in pretty_print_feeds
- Add missing exit(0) after rename command in main

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@antfred antfred merged commit fd454ce into master Apr 6, 2026
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.

1 participant