Skip to content

FileFS::toInternalPath() prepends working directory to absolute path #8

@j-j-banks

Description

@j-j-banks

FireFS::toInternalPath prepends working directory (which is confusingly referred to as $this->rootPath) to absolute path.

Example:
Current working directory is /Users/dennis/bin/
FileFS::toIntenralPath('/Users/dennis/Docs')
Result: /Users/dennis/bin/Users/dennis/Docs

To circumvent this, I have modified from line 368 as follows:
// Prepend the root path
if (substr($internalPath, 0, 1) !== DIRECTORY_SEPARATOR) { // Added - Lovelady, 7-Feb-2024 (process was prepending "root path" to absolute path)
$rootPath = $this->rootPath();
if (!empty($rootPath)) {
$internalPath = $this->makePath($rootPath, $internalPath);
}
} // Added - Lovelady, 7-Feb-2024 (process was prepending "root path" to absolute path)

But since I don't necessarily understand all the conditions that this routine might be trying to address, I am not certain this is a fix for all conditions. It would be better to have the source fixed in the official distribution. It was very tempting, for example, to test for (substr($internalPath, 0, 1) !== DIRECTORY_SEPARATOR) and return unchanges on true, right at the top of toInternalPath(), which is where I suspect it actually belongs.

Metadata

Metadata

Assignees

Labels

good first issueGood for newcomersquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions