mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+fix: UNC path prefix handling issues
This commit is contained in:
parent
d33e1ed68d
commit
ffbe839ead
@ -330,14 +330,16 @@ static void PrependLongPathPrefix(HPATHL hpth_in_out, bool bForce)
|
||||
static LPCWSTR _Path_SkipLPPrefix(const HSTRINGW hpth_str)
|
||||
{
|
||||
LPCWSTR start = StrgGet(hpth_str);
|
||||
if (wcsstr(start, PATHLONG_PREFIX) == start) {
|
||||
if (wcsstr(start, PATHUNC_PREFIX1) == start) {
|
||||
start += wcslen(PATHUNC_PREFIX1) - 1;
|
||||
}
|
||||
else if (wcsstr(start, PATHLONG_PREFIX) == start) {
|
||||
start += wcslen(PATHLONG_PREFIX);
|
||||
}
|
||||
return start;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
static void _UnExpandEnvStrgs(HSTRINGW hstr_in_out)
|
||||
{
|
||||
if (!hstr_in_out) {
|
||||
@ -404,6 +406,12 @@ static bool _PathCanonicalize(HSTRINGW hstr_in_out)
|
||||
size_t i, j, k;
|
||||
i = j = k = (start - path);
|
||||
|
||||
// Skip UNC Path
|
||||
while ((path[i] == L'\\') && path[i + 1] == L'\\') {
|
||||
i++;
|
||||
}
|
||||
j = k = i;
|
||||
|
||||
// Parse the entire string
|
||||
do {
|
||||
// Backslash separator found?
|
||||
@ -1795,7 +1803,7 @@ size_t PTHAPI Path_NormalizeEx(HPATHL hpth_in_out, const HPATHL hpth_wrkdir, boo
|
||||
if ((wcslen(buf) < MAX_PATH_EXPLICIT) || HasOptInToRemoveMaxPathLimit()) {
|
||||
if ((wcsstr(ptr, PATHUNC_PREFIX1) == ptr) ||
|
||||
(wcsstr(ptr, PATHUNC_PREFIX2) == ptr)) {
|
||||
ptr += (wcslen(PATHUNC_PREFIX1) - 1);
|
||||
ptr += (wcslen(PATHUNC_PREFIX1) - 2);
|
||||
*ptr = L'\\';
|
||||
}
|
||||
else if (wcsstr(ptr, PATHLONG_PREFIX) == ptr) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user