feat(httpserver): improved mimetype handling for frontend files (#1481)

This commit is contained in:
Kostiantyn Levytskyi
2025-01-04 11:41:36 +02:00
committed by GitHub
parent 48755f3008
commit 0efec12de6
3 changed files with 9 additions and 5 deletions

View File

@ -465,8 +465,8 @@ static int http_rest_get_lfs_file(http_request_t* request) {
mimetype = "image/x-icon";
break;
}
if (EndsWith(fpath, ".js")) {
mimetype = "text/javascript";
if (EndsWith(fpath, ".js") || EndsWith(fpath, ".vue")) {
mimetype = httpMimeTypeJavascript;
break;
}
if (EndsWith(fpath, ".json")) {
@ -474,11 +474,11 @@ static int http_rest_get_lfs_file(http_request_t* request) {
break;
}
if (EndsWith(fpath, ".html")) {
mimetype = "text/html";
mimetype = httpMimeTypeHTML;
break;
}
if (EndsWith(fpath, ".vue")) {
mimetype = "application/javascript";
if (EndsWith(fpath, ".css")) {
mimetype = httpMimeTypeCSS;
break;
}
break;