cfug / cfug/dio

Unable to get file or file path from a MultipartFile object

Open
#2,348 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

s: feature
Dominant language
Dart
Stars
12.8k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Request Statement

Hello Team,

Thank you for maintaining and enhancing the Dio library; it's an essential tool for many developers. I am using the latest version of Dio and encountered a limitation that affects my use case.

Context

I am implementing a feature that requires generating a checksum key by encrypting the entire payload during request interception. While encrypting, I must include file information (e.g., file path or file content) in the checksum generation for requests containing MultipartFile.

Current Issue

Currently, the MultipartFile class does not provide a direct way to access file information such as the file path or File object during request interception. This limitation makes it challenging to include the file content in the encryption process.

Feature Request

I kindly request the addition of a parameter or method in the MultipartFile class to access file information, such as:

The file path (if applicable).
A File object (if the source file exists).

Example
final file = MultipartFile.fromFileSync('path/to/file', filename: 'example.txt');
// Access file information
print(file.filePath); // Outputs: path/to/file
print(file.file);     // Outputs: File object
Benefits

Enables comprehensive payload encryption during interception, including file content.
Simplifies workflows that rely on accessing file metadata or content.

Thank you for considering this feature request. I am happy to provide additional details or talk about this more if you need them.

Solution Brainstorm

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MultipartFile class and the fromFileSync example described in the issue, then trace how MultipartFile is exposed during request interception. Define and implement the requested file path, File object, or equivalent access, and verify that multipart requests can include the needed file information for checksum generation.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.