src: use starts_with in fs_permission.cc

PR-URL: https://github.com/nodejs/node/pull/55811
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
pull/56364/head
ishabi 2024-12-25 04:33:32 +01:00 committed by GitHub
parent bd0b704d3c
commit 821b0a733e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -58,16 +58,16 @@ bool is_tree_granted(
std::string resolved_param = node::PathResolve(env, {param});
#ifdef _WIN32
// Remove leading "\\?\" from UNC path
if (resolved_param.substr(0, 4) == "\\\\?\\") {
if (resolved_param.starts_with("\\\\?\\")) {
resolved_param.erase(0, 4);
}
// Remove leading "UNC\" from UNC path
if (resolved_param.substr(0, 4) == "UNC\\") {
if (resolved_param.starts_with("UNC\\")) {
resolved_param.erase(0, 4);
}
// Remove leading "//" from UNC path
if (resolved_param.substr(0, 2) == "//") {
if (resolved_param.starts_with("//")) {
resolved_param.erase(0, 2);
}
#endif