Skip to content

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

@rOb1zZle

Description

@rOb1zZle

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 firebase-tools@13.11.2 to glob@^10.4.1 in firebase-tools@13.11.3 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions