mirror of https://github.com/nodejs/node.git
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
parent
bd0b704d3c
commit
821b0a733e
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue