-
Couldn't load subscription status.
- Fork 70
Fix: Refactor AsyncFileResponse (File overload) #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Refactor AsyncFileResponse (File overload) #272
Conversation
This PR refactors a single overload of the AsyncFileResponse constructor. The changes improve speed, readability and maintainability by: - Replacing the strlen(contentType) == 0 check - Restructuring the logic for setting the Content-Disposition header. Explicitly separates inline serving from download attachments. - Not altering behavior.
There was a problem hiding this 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 refactors the AsyncFileResponse constructor overload to improve performance and code maintainability while preserving existing behavior. The changes optimize string operations and clarify the logic for setting Content-Disposition headers.
- Optimizes empty string check by replacing
strlen(contentType) == 0with*contentType == '\0' - Restructures Content-Disposition header logic to clearly separate inline serving from download attachments
- Replaces hardcoded strings with template constants and simplifies buffer handling
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
used Arduino String + reserve() + heap allocation
|
Thanks a lot @JosePineiro 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
This PR refactors a single overload of the AsyncFileResponse constructor. The changes improve speed, readability and maintainability by: