sebastienros / fluid

Fluid is an open-source .NET template engine based on the Liquid template language.
MIT License
1.35k stars 172 forks source link

changing view name to match file casing in minimal api sample #626

Closed AlexGirardDev closed 5 months ago

AlexGirardDev commented 5 months ago

fix for #625

AlexGirardDev commented 5 months ago

the other solution to this would have been to make this ignore file name casing when looking for files but just updating the view name seemed simpler

sebastienros commented 5 months ago

I checked the other files, and I see that _layout.liquid is referenced using _Layout, so it shouldn't work either. Can you confirm?

sebastienros commented 5 months ago

I kind of like the PascalCasing of files, if you do too then let's use that solution instead. If you don't then I'll agree with your changes.

AlexGirardDev commented 5 months ago

good point, i just checked and layout is'nt being loaded at all because the viewstart is not being loaded. its file name is coming from here which seems to be used by the renderer so i wonder if its just easier to proper case all the luiqud files

sebastienros commented 5 months ago

Looks like we have to then, good catch.

sebastienros commented 5 months ago

I wonder is ASP.NET is also forcing Viewstart files to follow this case on Linux.

AlexGirardDev commented 5 months ago

i was curious and it just seemms like there file names are just completly case insensitive ASP.NET

i just started renaming these and everything worked as expected image

they all did start as proper case though

sebastienros commented 5 months ago

I assume you tried this on Linux? (I would think so since this is how you found about this issue)

AlexGirardDev commented 5 months ago

Ya, everything has been on linux with Rider.

I think views and more specfically _ViewStart being case sensitive could catch some people off gaurd and may be worth calling out in the docs. Especially if they are developing on windows and then deploying to linux through docker (which is pretty common nowadays i believe).

The test i did with ASP.NET was with compiled templates so i'm assuming this is how they get around the case sensitivity thing, they can just load all there templates into memory and access they view names while ignoring case through managed c# code.

But if your loading the files from disk at runtime, I think its tricker beacuse the native OS calls on a case sesenitve system won't let you access a file while ignoring case.

I was googling around a bit and found this issue on the dotnet runtime that is tangentually related https://github.com/dotnet/runtime/issues/91250