3d91dda86ff75aa59b6095ae6bcab96d72f99656 jcasper Wed Mar 18 22:45:15 2026 -0700 eatExcessDotDotInPath does unexpected things with inputs like ../../ and /a/./.. . Adding an alternate version until we can assess the impacts of changing. refs #36320, #37263 diff --git src/inc/filePath.h src/inc/filePath.h index e6fc303fadc..245c0b46321 100644 --- src/inc/filePath.h +++ src/inc/filePath.h @@ -35,16 +35,22 @@ void undosPath(char *path); /* Convert '\' to '/' in path. (DOS/Windows is typically ok with * this actually.) */ char *makeRelativePath(char *from, char *to); /* Calculate a relative path from one absolute directory/file to another. * Assumptions: both from and to are canonicalized absolute paths beginning * at "/" or "//". Filenames are okay, but all directory names must end with * a "/" to distinguish them from files. * e.g., /test/dir/ is a directory, but /test/dir is a file. */ boolean isSafeRelativePath(char *path); /* check that path is relative and contains no ".." elements */ +char *resolveDotDots(char *pathOrUrl); +/* Given a file path or URL, return a version with "." and ".." components resolved. + * For URLs, only the path portion is simplified (scheme :// is preserved). + * Double slashes are collapsed for file paths but not for URLs. + * Result should be freeMem'd. */ + #endif /* FILEPATH_H */