Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
318 stars 53 forks source link

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

Open msamadony opened 1 month ago

msamadony commented 1 month ago

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://<sitename>.westeurope.5.azurestaticapps.net/assets/app_data/data.json 404 (Not Found)
GET https://<sitename>.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.

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

image

Device info (if applicable):