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

Incorrect Path Formatting in Firebase-Tools on Windows with Version 13.11.3 and Above #7378

Closed
rOb1zZle opened this issue Jun 25, 2024 · 1 comment · Fixed by #7382
Closed

Comments

@rOb1zZle
Copy link

rOb1zZle commented Jun 25, 2024

Environment info

firebase-tools:
>= 13.11.3

Platform:
Windows 11 Home - Version 10.0.22631 Build 22631

Test case

Attempting to deploy built public / dist folder for firebase hosting including files within subdirectories leads to incorrect path handling on Windows.

Steps to reproduce

  1. Update to firebase-tools version 13.11.3 or newer on a Windows PC.
  2. Run a deploy like "firebase deploy --only hosting --debug" that accesses files in subdirectories.
  3. Notice in deploy debug log that file paths use incorrect path separators (\\ instead of /).

Expected behavior

Files should be handled correctly across all platforms with the correct path separators. For example, file paths should consistently use forward slashes (/) instead of (double) backslashes (\\).

Actual behavior

When deploying files or accessing files in subdirectories, firebase-tools generates paths with backslashes (\\) instead of forward slashes (/). This leads to correct upload but wrong file paths. In this case my "rewrites" config is forced to deliver "index.html" instead of wanted files.

For example:

  • Expected path: /fonts/CircularStd-Medium.otf
  • Actual path generated: /fonts\\CircularStd-Medium.otf

Observations / Solution

This issue only arises in firebase-tools version 13.11.3 and above. The problem seems to be related to the update of the glob package used within firebase-tools. Because glob@^7.1.2 (deprecated) was updated in [email protected] to glob@^10.4.1 in [email protected] and above. Already tested on MacOS there are no path issues.

Setting posix: true in firebase-tools listFiles configuration fixes this issue in my case, suggesting a regression in the latest versions. The issue occurs when there are subdirectories with nested files; paths at root level (/public or /dist) are formatted correctly, but paths in deeper directories are not.

I wanted to share this solution to prevent others from encountering the same issue and spending extensive time debugging, as I did. There's currently limited information available online about this problem, so I hope this report will assist others in quickly resolving similar issues.

@Ihernandezpi
Copy link

Ihernandezpi commented Jun 26, 2024

Still happen 😬 on v13.12.0

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

Successfully merging a pull request may close this issue.

4 participants