Issues with `netlify dev` and square brackets in static file paths


My netlify site is:

I’m experiencing a problem when using netlify dev that is not present in the production environment.

I’m using next.js to create a statically generated site that will be hosted on the CDN. Within my site are directory slugs.

For example I’ve got a structure in my pages directory like that reflects the use of a slug [locale] in the path of my routes:


Ultimately when I use next export I get a site generated as expected and all works well in production. However when using netlify dev I noticed that some of the statically generated javascript was not being loaded due to a 404 error for all pages underneath the slug directory [locale].

Digging deeper I found that one of the files loaded with a slug route such as /en-CA/puzzle, includes the square bracket characters as url encoded in the file name, like so:[locale]/puzzle-40106a61f2eb3c8af9d4.js

Notice the %5Blocale%5D which equates to [locale]. In my local netlify dev environment, when I hit theh the URL as generated by the site with url encoding, the file is not found. However if I modified the URL manually and use square brackets in place of the url encoded bits, the file loads properly.

This looks like a bug which could be fixed for netlify dev if the server url-decodes the static file path before searching for it on the local drive.

hi there, could you check here to see if an issue regarding this behaviour has already been filed?

if not, please file a new one and we can investigate!

Hi @perry,

Sorry for the delay in responding. I couldn’t find a similar issue on github. I’ll file an issue there so that you folks can investigate.

1 Like

Hi @mashaalm I’m facing the same issue now so did you file an issue or not and if you filed an issue can you share the issue number or link please

hi there @Med , i don’t see an issue here - but if you are facing the same problem, please do file one! thanks.

@Med , don’t recall filing that issue as I got wrapped up in other things. :man_facepalming: . If you end up filing the issue, let me know and I’ll 2nd it!