From 18739394e1e15f6675a600c9f36f3d10a0e80e16 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 28 Jan 2024 17:37:19 +0000 Subject: [PATCH] Fix paths of content in tar files --- src/fileio.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fileio.cpp b/src/fileio.cpp index 0272fe10d5..37d1eb34ef 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -525,7 +525,8 @@ bool TarScanner::AddFile(const std::string &filename, size_t basepath_length, co _tar_list[this->subdir][filename] = std::string{}; - std::string filename_base = filename; + auto last_sep = filename.find_last_of(PATHSEP); + std::string filename_base = last_sep == std::string::npos ? filename : filename.substr(last_sep + 1); SimplifyFileName(filename_base.data()); TarLinkList links; ///< Temporary list to collect links