Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paths not resolved correctly on Windows #443

Open
wants to merge 1 commit into
base: release/9.2.3
Choose a base branch
from

Conversation

ashthomas92
Copy link

On Windows, no paths are resolved from the manifest, leading to a InvalidManifest exception.

Description

The Helpers::joinPaths() method prepends the directory separator onto the generated base file path. On Windows this causes the paths not to be resolved, leading to it being unable to read any files from manifest.json. This fix checks to see if the base path has a disk indicator prefixing the path, and only prepends the separator when it doesn't.

…nt of it, and this prevents file paths from being resolved on windows. It now checks to see if we are using a drive name indicator before adding the prefix.
@piqusy piqusy requested review from iruzevic and a team November 20, 2024 15:56
@mbmjertan
Copy link
Collaborator

Glad to see Eightshift usage and contributions.

I think this method is unreliable, especially for extending Eightshift, and should be refactored entirely. I am willing to do this myself.

This isn't at all a critique of your PR, @ashtomas92, and I am very grateful to see contributions.

  • regarding your PR, filenames on Linux can contain :, so this check can break paths on Linux
  • regarding the original implementation, why would all calls to this method need to include ABSPATH to be correct? can this not be a flag?

why couldn't I just do this:

file_get_contents(Helpers::joinPaths(['Blocks', 'components', 'heading', 'manifest.json']
  • we should probably also do some test coverage for Windows-particular filepath construction, given how often we've ran into issues with that

Once again, very happy to see contributions. I am hoping a fix will get merged soon.

@piqusy piqusy changed the base branch from main to release/9.2.3 November 21, 2024 08:49
@hexydec
Copy link

hexydec commented Nov 25, 2024

If the original path is captured from a known location using __DIR__, the base path should be easy to work out without de/reconstructing it, the slash at the start can then just remain if it was already present, same for the drive indicator as per Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants