Skip to content

Powershell files served as binary #72

Open

Description

@seankearon

Powershell scripts are served up as application/octet-stream. Is there a way to serve these up as text? (I've already tried adding a MIME type in IIS.)

Activity

  1. otac0n commented on May 15, 2013

    @otac0n
    Owner

    The current implementation first checks a file, called "mime-types.txt", located in the sharedlib project.

    If it fails to find the file extension in that file, it searches the windows registry for the mime type.

    See:
    https://github.com/otac0n/WebGitNet/blob/master/WebGitNet.SharedLib/MimeUtilities.cs

    You can add a value HKEY_CLASSES_ROOT\.ps1\ContentType set to something like text/x-powershell-source on your server, or you can modify that mime-types.txt file.

    I'm going to keep this bug open until we have an entry in mime-types.txt for powershell.

  2. seankearon commented on May 16, 2013

    @seankearon
    Author

    That does the job - many thanks!

  3. otac0n commented on May 26, 2013

    @otac0n
    Owner

    There are several examples of this issue:

    .cmd, .nsi, .ls, .bxrc
    

    The point is that it is an insurmountable challenge to build an exhaustive list. We should default to the git method of detecting a binary vs text file. Specifically, we should check the first chunk (1kb?) of the file for any null bytes. This is slightly problematic when dealing with multibyte encodings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions