mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: the issue of arbitrary truncation in multibyte encoding in IsInPath(), the root cause of #2631
(cherry picked from commit b10bd5609f)
This commit is contained in:
parent
2bd7e55427
commit
eb40b80116
1 changed files with 6 additions and 6 deletions
|
|
@ -752,12 +752,12 @@ begin
|
|||
|
||||
sBasePath := IncludeTrailingPathDelimiter(sBasePath);
|
||||
|
||||
BasePathLength := Length(sBasePath);
|
||||
PathToCheckLength := Length(sPathToCheck);
|
||||
BasePathLength := UTF8Length(sBasePath);
|
||||
PathToCheckLength := UTF8Length(sPathToCheck);
|
||||
|
||||
if PathToCheckLength > BasePathLength then
|
||||
begin
|
||||
if mbCompareFileNames(Copy(sPathToCheck, 1, BasePathLength), sBasePath) then
|
||||
if mbCompareFileNames(UTF8Copy(sPathToCheck, 1, BasePathLength), sBasePath) then
|
||||
begin
|
||||
if AllowSubDirs then
|
||||
Result := True
|
||||
|
|
@ -766,10 +766,10 @@ begin
|
|||
// Additionally check if the remaining path is a relative path.
|
||||
|
||||
// Look for a path delimiter in the middle of the filepath.
|
||||
sPathToCheck := Copy(sPathToCheck, 1 + BasePathLength,
|
||||
sPathToCheck := UTF8Copy(sPathToCheck, 1 + BasePathLength,
|
||||
PathToCheckLength - BasePathLength);
|
||||
|
||||
DelimiterPos := Pos(DirectorySeparator, sPathToCheck);
|
||||
DelimiterPos := UTF8Pos(DirectorySeparator, sPathToCheck);
|
||||
|
||||
// If no delimiter was found or it was found at then end (directories
|
||||
// may end with it), then the 'sPathToCheck' is in 'sBasePath'.
|
||||
|
|
@ -784,7 +784,7 @@ begin
|
|||
(((PathToCheckLength = BasePathLength) and
|
||||
(mbCompareFileNames(sPathToCheck, sBasePath))) or
|
||||
((PathToCheckLength = BasePathLength - 1) and
|
||||
(mbCompareFileNames(Copy(sBasePath, 1, PathToCheckLength), sPathToCheck))));
|
||||
(mbCompareFileNames(UTF8Copy(sBasePath, 1, PathToCheckLength), sPathToCheck))));
|
||||
end;
|
||||
|
||||
function ExtractDirLevel(const sPrefix, sPath: String): String;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue