Nancy icon indicating copy to clipboard operation
Nancy copied to clipboard

Easy Fix: Add Support For Lowercase Content Folder On Unix

Open nkosi23 opened this issue 6 years ago • 0 comments

Prerequisites

  • [ X] I have written a descriptive issue title
  • [ X] I have verified that I am running the latest version of Nancy
  • [X ] I have verified if the problem exist in both DEBUG and RELEASE mode
  • [ X] I have searched open and closed issues to ensure it has not already been reported

Description

Unix is case sensitive. At the same time, for Unix projects, the convention usually is to name folders in lowercase (and use a dash as a space separator).

The built-in StaticContent convention shipped with Nancy defines a "Content" folder convention (with a capitalized C). If the user has a lower case content folder, 404s will be returned. Far from being cosmetics, this is a bug since at the same time, if the user tries to add a "content" folder convention in the Bootstrapper (lowercase), it will be silently ignored since Nancy assumes that the convention already exists. This is troubling and requires digging into Nancy source code before figuring out what is happening.

Two small changes are required:

  • Make the Convention builder case sensitive so that both "Content" and "content" conventions can be added
  • Ship a default "content" convention in addition to the "Content" convention

This approach allows the fix to be non-disruptive for Unix users (whether or not they are currently using Content or content).

Steps to Reproduce

Create a self-hosted project, with a lowercase content folder and deploy it on an Unix platform. Run it using mono.

System Configuration

Unix

  • Nancy version:
  • Nancy host
    • [ ] Nancy.Hosting.Aspnet
    • [ X] Nancy.Hosting.Self
    • [ ] Nancy.Owin ()
    • [ ] Other:
  • Other Nancy packages and versions:
  • Environment (Operating system, version and so on):
  • .NET Framework version:
  • Additional information:

nkosi23 avatar Feb 15 '19 15:02 nkosi23