Skip to content

refactor: convert file-transfer-method-pipeline if/elif to match/case (#30001)#34788

Merged
asukaminato0721 merged 2 commits intolanggenius:mainfrom
dataCenter430:refactor/match-case-file-transfer-method-pipeline
Apr 9, 2026
Merged

refactor: convert file-transfer-method-pipeline if/elif to match/case (#30001)#34788
asukaminato0721 merged 2 commits intolanggenius:mainfrom
dataCenter430:refactor/match-case-file-transfer-method-pipeline

Conversation

@dataCenter430
Copy link
Copy Markdown
Contributor

Changes

Convert if/elif chains on transfer_method pipeline enum to exhaustive match/case statements in message_file_utils.py.

Part of #30001.

Files changed

  • api/core/app/task_pipeline/message_file_utils.py

All tests passed.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor labels Apr 9, 2026
@asukaminato0721 asukaminato0721 requested a review from Copilot April 9, 2026 01:10
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

Pyrefly Diff

No changes detected.

Copy link
Copy Markdown
Contributor

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

Refactors prepare_file_dict() in the task pipeline to use match/case on the FileTransferMethod enum, aligning with the codebase goal of making enum branching more explicit and easier to keep exhaustive as new transfer methods are added.

Changes:

  • Replaced if/elif branching on message_file.transfer_method with match/case.
  • Kept existing URL/filename/extension derivation logic for REMOTE_URL, LOCAL_FILE, and TOOL_FILE (including guarded handling when message_file.url is present).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@asukaminato0721 asukaminato0721 self-requested a review April 9, 2026 01:15
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 9, 2026
@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

Pyrefly Diff

No changes detected.

@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 9, 2026
Merged via the queue into langgenius:main with commit 2275c5b Apr 9, 2026
26 of 27 checks passed
HanqingZ pushed a commit to HanqingZ/dify that referenced this pull request Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants