[#188] Improve content-type detector #189

Open
KurlesHS wants to merge 1 commit from KurlesHS/frostfs-http-gw:feat/improve_content_type_detector into master
Member

I looked at several libraries that guess the content type from the content, but none of them correctly identified either the text/css or text/javascript content type.
I also investigated how the rclone utility and the MinIO server determine the type of content. Both of these software first pay attention to the content-type header. If it's missing, they set the content type by file extension.

In our case, I decided to combine both methods. First, we will attempt to determine the content type based on the content itself. If the content appears to be text/plain, we will then use the file extension to determine the exact type of content.

Signed-off-by: Aleksey Kravchenko al.kravchenko@yadro.com

I looked at several libraries that guess the content type from the content, but none of them correctly identified either the `text/css` or `text/javascript` content type. I also investigated how the rclone utility and the MinIO server determine the type of content. Both of these software first pay attention to the `content-type` header. If it's missing, they set the content type by file extension. In our case, I decided to combine both methods. First, we will attempt to determine the content type based on the content itself. If the content appears to be `text/plain`, we will then use the file extension to determine the exact type of content. Signed-off-by: Aleksey Kravchenko <al.kravchenko@yadro.com>
KurlesHS added 1 commit 2024-12-24 16:41:46 +00:00
[#188] Improve content-type detector
All checks were successful
/ DCO (pull_request) Successful in 2m58s
/ Vulncheck (pull_request) Successful in 3m14s
/ Builds (pull_request) Successful in 4m1s
/ Lint (pull_request) Successful in 4m8s
/ Tests (pull_request) Successful in 3m36s
a1097b7c59
Signed-off-by: Aleksey Kravchenko <al.kravchenko@yadro.com>
KurlesHS requested review from storage-services-developers 2024-12-24 16:41:46 +00:00
KurlesHS requested review from storage-services-committers 2024-12-24 16:41:46 +00:00
KurlesHS self-assigned this 2024-12-24 16:42:37 +00:00
alexvanin added this to the v0.33.0 milestone 2024-12-25 06:33:15 +00:00
dkirillov approved these changes 2024-12-25 08:23:22 +00:00
dkirillov left a comment
Member

LGTM

LGTM
All checks were successful
/ DCO (pull_request) Successful in 2m58s
Required
Details
/ Vulncheck (pull_request) Successful in 3m14s
Required
Details
/ Builds (pull_request) Successful in 4m1s
Required
Details
/ Lint (pull_request) Successful in 4m8s
Required
Details
/ Tests (pull_request) Successful in 3m36s
Required
Details
This pull request doesn't have enough approvals yet. 1 of 2 approvals granted.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feat/improve_content_type_detector:KurlesHS-feat/improve_content_type_detector
git checkout KurlesHS-feat/improve_content_type_detector
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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: TrueCloudLab/frostfs-http-gw#189
No description provided.