Skip to content

Commit c600aa5

Browse files
House-MenCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent ea24920 commit c600aa5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

http/server/HttpHandler.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,9 @@ int HttpHandler::defaultRequestHandler() {
524524
int HttpHandler::defaultStaticHandler() {
525525
// file service
526526
std::string path = req->Path();
527-
path.resize(hv_normalize_path(const_cast<char*>(path.c_str())));
527+
if (!path.empty()) {
528+
path.resize(hv_normalize_path(&path[0]));
529+
}
528530
if (path.empty()) {
529531
hloge("[%s:%d] Illegal relative path: %s", ip, port, req->path.c_str());
530532
return HTTP_STATUS_BAD_REQUEST;

0 commit comments

Comments
 (0)