The Function FPaths::CollapseRelativeDirectories assumes that any instance of the characters "/.." are a relative path to the parent directory, and removes them along with the preceding directory. However, it's valid in Windows to create a folder that beings with two periods, meaning the resulting path will be misinterpreted by our collapse function. This caused an issue with a licensee where a user had put two periods before their username, resulting in the user directory "C:/Users/..username/somefolder" resolving as "C:username/somefolder".


Solving this would likely require looking ahead at the next character following "/.." to see if it is a slash or if it's at the end of the path. Otherwise, it should be ignored.

Steps to Reproduce

Run the following code, and observe the output:


FString Path = "C:/My/./Path/..FolderName";
UE_LOG(LogTemp, Warning, TEXT("Output: %s"),*Path);

Expected output: "C:/My/Path/..FolderName"

Actual output: "C:/My/.FolderName"


Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-76854 in the post.

Login to Vote

ComponentUE - Foundation - Core
Affects Versions4.24
Target Fix4.25
Fix Commit10407342
Main Commit10407342
CreatedJul 3, 2019
ResolvedNov 25, 2019
UpdatedMar 2, 2020
View Jira Issue