Azure / Azure/static-web-apps

Asset file is not found (404) if it is in a folder that contains an underscore

Open
#1,469 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Asset files are not found during fetching with javascript or accessing them through the browser when they are located in a folder that contains an underscore. The follow error is returned:
`The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.`

And the following is printed to the browser's console:
```
GET https://.westeurope.5.azurestaticapps.net/assets/app_data/data.json 404 (Not Found)
GET https://.westeurope.5.azurestaticapps.net/app_data/data.json 404 (Not Found)
```

The above behavior is observed while deploying a simple Vue3 app using SWA cli and GitHub action. The same code works fine on the local development server, and the issue only appears after deployment to SWA.

**To Reproduce**
Steps to reproduce the behavior:

With multiple `data.json` files located at the paths shown in the code below, those that are located in `*/app_data/` folder could not be retrieved.

```javascript
fetch("/data.json") --> OK
fetch("/assets/data.json") --> OK

fetch("/assets/app_data/data.json") --> 404
fetch("/app_data/data.json") --> 404

fetch("/appdata/data.json") --> OK
fetch("/app-data/data.json") --> OK
fetch("/d.a_t(a).json") --> OK
```

**Expected behavior**
The files should be accessible without a problem.

**Screenshots**

![image](https://github.com/Azure/static-web-apps/assets/224718/d1ab548d-3f5e-4e98-a685-afd0caff29cf)

![image](https://github.com/Azure/static-web-apps/assets/224718/ff492a48-72b0-4218-82d1-d829ce5b452d)

**Device info (if applicable):**
- OS: Windows 10
- Browser: Edge
- Version 123.0.2420.97

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.