| 480 | return "application/octet-stream"; |
| 481 | } |
| 482 | |
| 483 | Result HttpAsyncFileServer::Internal::extractSafeFilePath(StringSpan requestTarget, StringSpan& filePath) |
| 484 | { |
| 485 | HttpRequestTargetView target; |
| 486 | SC_TRY(target.parse(requestTarget)); |
| 487 | if (not HttpStringIterator::startsWith(target.path, "/")) |
| 488 | return Result::Error(HttpResultCategory, HttpError::FileServerRequestTargetNotPath); |
| 489 | |
| 490 | filePath = HttpStringIterator::sliceStart(target.path, 1); |
| 491 | if (filePath.isEmpty()) |
| 492 | { |
| 493 | filePath = "index.html"; |
| 494 | return Result(true); |
| 495 | } |
| 496 | |
| 497 | return validateSafeRelativePath(filePath); |
| 498 | } |
| 499 |
nothing calls this directly
no test coverage detected