[PR #762] [CLOSED] fix: 修复 IMAP fetch 方法返回生成器导致的 TypeError #749

Closed
opened 2026-02-26 21:32:47 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dreamhunter2333/cloudflare_temp_email/pull/762
Author: @nightwhite
Created: 11/9/2025
Status: Closed

Base: mainHead: main


📝 Commits (10+)

  • 7edc312 fix: 修复 IMAP fetch 方法返回生成器导致的 TypeError (#1)
  • 990a4c5 fix: 修复 S3 附件上传方式,使用 PUT 直接上传 blob 而非 FormData
  • dc18f1a feat: 优化 SMTP/IMAP 服务器配置和 Docker 镜像
  • 1e34063 fix: 修复 Dockerfile 运行阶段使用 slim 镜像以兼容 pydantic_core
  • 468b158 refactor: 简化 Dockerfile 为单阶段构建
  • 30ad6a9 feat: 增强邮件转发配置,支持精确匹配、通配符和已创建邮箱选择
  • f3272c2 fix: 修复获取地址列表时 limit 超限问题
  • 71a9317 fix: 增加 IMAP 服务器 HTTP 请求超时时间
  • 006926c fix: 修复邮件转发配置中通配符域名显示为 [object Object]
  • 0ffc60c fix: 修复邮件转发规则优先级问题

📊 Changes

9 files changed (+136 additions, -33 deletions)

View changed files

📝 README.md (+4 -1)
📝 README_EN.md (+4 -0)
📝 frontend/src/views/Index.vue (+5 -4)
📝 frontend/src/views/admin/AccountSettings.vue (+38 -4)
📝 smtp_proxy_server/.env.example (+2 -0)
📝 smtp_proxy_server/config.py (+1 -0)
📝 smtp_proxy_server/dockerfile (+13 -3)
📝 smtp_proxy_server/imap_server.py (+16 -12)
📝 worker/src/email/index.ts (+53 -9)

📄 Description

修复了在 K8s/Docker 环境中运行时出现的错误:
File "/usr/local/lib/python3.12/site-packages/twisted/mail/imap4.py", line 1685, in __cbManualSearch
lastSequenceId = result and result[-1][0]
TypeError: 'generator' object is not subscriptable

问题原因:

  • fetch 方法返回了生成器对象
  • Twisted IMAP4 库在处理 SEARCH 命令时需要对结果进行索引访问
  • 生成器不支持索引操作

解决方案:

  • 将 fetch 方法的返回值从生成器改为列表
  • 保持 fetchGenerator 方法的分批获取逻辑(batch_size=20)
  • 确保内存占用可控的同时支持所有 IMAP 操作

🔄 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/dreamhunter2333/cloudflare_temp_email/pull/762 **Author:** [@nightwhite](https://github.com/nightwhite) **Created:** 11/9/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (10+) - [`7edc312`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/7edc312984d8df50dae5f56500543f65d033eb4f) fix: 修复 IMAP fetch 方法返回生成器导致的 TypeError (#1) - [`990a4c5`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/990a4c58ef0862d39b0e0f742e6018f188317b4b) fix: 修复 S3 附件上传方式,使用 PUT 直接上传 blob 而非 FormData - [`dc18f1a`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/dc18f1a666fcbeb4ea285e032832179ed45e15b6) feat: 优化 SMTP/IMAP 服务器配置和 Docker 镜像 - [`1e34063`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/1e340636008b5772fd0bc83387285efde93c668c) fix: 修复 Dockerfile 运行阶段使用 slim 镜像以兼容 pydantic_core - [`468b158`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/468b158a951eebec554993a656c23a074b1f61f0) refactor: 简化 Dockerfile 为单阶段构建 - [`30ad6a9`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/30ad6a9a5a7f1cfc61ad03654f5ab30775f2bbf2) feat: 增强邮件转发配置,支持精确匹配、通配符和已创建邮箱选择 - [`f3272c2`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/f3272c2e0716f631f7a306867d53a60e696a8f71) fix: 修复获取地址列表时 limit 超限问题 - [`71a9317`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/71a9317d5dc60801680d61040eb4a39f6554e7c2) fix: 增加 IMAP 服务器 HTTP 请求超时时间 - [`006926c`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/006926c2d5bba3c6434b80a33ee3cf16732b34c0) fix: 修复邮件转发配置中通配符域名显示为 [object Object] - [`0ffc60c`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/0ffc60c316e6f3bc1a11821dd636f9ad8e15dbfc) fix: 修复邮件转发规则优先级问题 ### 📊 Changes **9 files changed** (+136 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+4 -1) 📝 `README_EN.md` (+4 -0) 📝 `frontend/src/views/Index.vue` (+5 -4) 📝 `frontend/src/views/admin/AccountSettings.vue` (+38 -4) 📝 `smtp_proxy_server/.env.example` (+2 -0) 📝 `smtp_proxy_server/config.py` (+1 -0) 📝 `smtp_proxy_server/dockerfile` (+13 -3) 📝 `smtp_proxy_server/imap_server.py` (+16 -12) 📝 `worker/src/email/index.ts` (+53 -9) </details> ### 📄 Description 修复了在 K8s/Docker 环境中运行时出现的错误: File "/usr/local/lib/python3.12/site-packages/twisted/mail/imap4.py", line 1685, in __cbManualSearch lastSequenceId = result and result[-1][0] TypeError: 'generator' object is not subscriptable 问题原因: - fetch 方法返回了生成器对象 - Twisted IMAP4 库在处理 SEARCH 命令时需要对结果进行索引访问 - 生成器不支持索引操作 解决方案: - 将 fetch 方法的返回值从生成器改为列表 - 保持 fetchGenerator 方法的分批获取逻辑(batch_size=20) - 确保内存占用可控的同时支持所有 IMAP 操作 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 21:32:47 +03: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
starred/cloudflare_temp_email#749
No description provided.