Skip to content

Conversation

@whitewatercn
Copy link
Collaborator

@whitewatercn whitewatercn commented Oct 16, 2025

主要更新

  • 删除了功能重复的 rimetool/rimetool_core/main.py, 目前负责传入参数、命令行操作的是 rimetool/main.py
  • 简化了rimetool/rimetool_gui/new_app.py 里import rimetool/main.py 相关的代码,写死了
  • 简化了rimetool/rimetool_gui/new_app.py 里关于 Content-Disposition相关的内容,写死为utf-8(因为我们的用户基本都使用现代的chromium、firefox,基本都支持UTF-8),但仍保留了 修复文件名乱码 #50 里完善好的同时支持utf-8和ASCII的代码(ASCII用于支持老浏览器),未来如果有需要就启用

次要更新

更新pypi包版本号为2.4.4

@whitewatercn whitewatercn requested a review from Copilot October 16, 2025 02:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR simplifies the codebase by removing duplicate functionality and streamlining import logic. It eliminates redundant file handling and reduces complexity in Content-Disposition header management.

  • Removed duplicate rimetool/rimetool_core/main.py file that provided redundant functionality
  • Simplified import logic in GUI module by removing fallback mechanisms
  • Hardcoded UTF-8 encoding for Content-Disposition headers while preserving commented ASCII fallback code

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
rimetool/rimetool_gui/new_app.py Simplified import logic and Content-Disposition handling to use only UTF-8 encoding
rimetool/rimetool_core/main.py Completely removed duplicate main.py file
pyproject.toml Updated version number from 2.4.3 to 2.4.4

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +285 to +293
# 若未来需要兼容极老旧浏览器(仅识别 filename 的 ASCII),可恢复以下逻辑:
# try:
# original_filename.encode('ascii')
# response.headers["Content-Disposition"] = f'attachment; filename="{original_filename}"'
# logger.info(f"文件名使用ASCII编码: {original_filename}")
# except UnicodeEncodeError:
# encoded_filename = quote(original_filename)
# response.headers["Content-Disposition"] = f"attachment; filename*=UTF-8''{encoded_filename}"
# logger.info(f"设置UTF-8编码文件名: {encoded_filename}")
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider removing the large commented code block instead of keeping it inline. If this fallback logic needs to be preserved, move it to documentation or version control history to maintain code readability.

Suggested change
# 若未来需要兼容极老旧浏览器(仅识别 filename 的 ASCII),可恢复以下逻辑:
# try:
# original_filename.encode('ascii')
# response.headers["Content-Disposition"] = f'attachment; filename="{original_filename}"'
# logger.info(f"文件名使用ASCII编码: {original_filename}")
# except UnicodeEncodeError:
# encoded_filename = quote(original_filename)
# response.headers["Content-Disposition"] = f"attachment; filename*=UTF-8''{encoded_filename}"
# logger.info(f"设置UTF-8编码文件名: {encoded_filename}")
# 若未来需要兼容极老旧浏览器(仅识别 filename 的 ASCII),可从版本控制历史恢复相关逻辑。

Copilot uses AI. Check for mistakes.
@whitewatercn whitewatercn requested a review from JyiDeng October 16, 2025 02:39
这个改动也挺好,加上

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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