react / react/metro

Handling of Special Characters in Asset File Names Causes Build Failures

Open
#1,266 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.6k
Forks
696
Avg merge
8m
Merged PRs (30d)
7

Description

Hi there,

I've encountered an issue with Metro where asset file names containing special characters (specifically the ampersand &) cause the build process to fail. An example of this is when using the font file named LCDAT&TPhoneTimeDate.ttf, which required renaming to LCDAT.ttf to resolve the issue.

This seems to be a parsing or handling error related to special characters in file names, which might not be adequately handled or escaped during the build process.

Steps to Reproduce:

  1. Include a file with an ampersand (&) in the name, e.g., LCDAT&TPhoneTimeDate.ttf, in the assets directory.
  2. Run npx expo start
  3. Wait for iOS bundling to finish
  4. Observe the error

Expected Behavior:
The build process should handle file names with special characters without failing, or there should be clear documentation on file name restrictions.

Actual Behavior:
The build fails (or behaves unexpectedly), and the file must be renamed to exclude special characters for successful processing.

Is this a known limitation with Metro's file handling, or is this something that can be improved either in functionality or documentation?

Thanks for looking into this!

This issue was prompted by troubleshooting during development, where renaming the file resolved the build issues.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with an asset named LCDAT&TPhoneTimeDate.ttf and run npx expo start, then trace Metro's asset filename handling during iOS bundling. Done means the asset builds successfully with the ampersand, or the supported filename restrictions are clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.