diff --git a/CMakeLists.txt b/CMakeLists.txt index c4dc754cc..9f272537d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.11.4) project( linglong - VERSION 1.13.3 + VERSION 1.13.4 DESCRIPTION "a container based application package manager for Linux desktop" HOMEPAGE_URL "https://github.com/OpenAtom-Linyaps/linyaps" LANGUAGES CXX C) diff --git a/libs/linglong/src/linglong/cli/cli.cpp b/libs/linglong/src/linglong/cli/cli.cpp index b25250546..82e14de46 100644 --- a/libs/linglong/src/linglong/cli/cli.cpp +++ b/libs/linglong/src/linglong/cli/cli.cpp @@ -1787,8 +1787,18 @@ int Cli::content(const ContentOptions &options) LogE("failed to check symlink {}: {}", file.c_str(), ec.message()); } - // Dont't mapping the file under /home - if (auto tmp = target.string(); tmp.rfind("/home/", 0) == 0) { + auto *homePath = ::getenv("HOME"); + if (homePath == nullptr || homePath[0] == '\0') { + LogE("failed to get HOME env"); + return target; + } + + // Don't map files under the user's home directory + auto homeStr = std::string(homePath); + if (homeStr.back() != '/') { + homeStr.push_back('/'); + } + if (auto tmp = target.string(); tmp.rfind(homeStr, 0) == 0) { return target; }