diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index d2466857e5110..f6355ccf4f844 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -457,7 +457,7 @@ writeFileDefinition(const Location &L,
Node->Children.emplace_back(std::make_unique(" of file "));
auto LocFileNode = std::make_unique(
HTMLTag::TAG_A, llvm::sys::path::filename(FileURL));
- LocFileNode->Attributes.emplace_back("href", std::string(FileURL.str()));
+ LocFileNode->Attributes.emplace_back("href", std::string(FileURL));
Node->Children.emplace_back(std::move(LocFileNode));
return Node;
}