Skip to content

Commit 979f089

Browse files
stduhpfwbruna
andcommitted
Fix symlink handling
- Use lexically_relative for safer path computation. Co-authored-by: Wagner Bruna <wbruna@users.noreply.github.com>
1 parent 47e46bc commit 979f089

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/server/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ std::vector<std::string> list_files(const std::string& dir_path) {
17741774
if (dir_path != "")
17751775
for (const auto& entry : fs::recursive_directory_iterator(dir_path)) {
17761776
if (entry.is_regular_file()) {
1777-
auto relative_path = fs::relative(entry.path(), dir_path);
1777+
auto relative_path = entry.path().lexically_relative(dir_path);
17781778
std::string path_str = relative_path.string();
17791779
std::replace(path_str.begin(), path_str.end(), '\\', '/');
17801780
files.push_back(path_str);

0 commit comments

Comments
 (0)