Skip to content
This repository was archived by the owner on Nov 22, 2018. It is now read-only.
This repository was archived by the owner on Nov 22, 2018. It is now read-only.

StaticFiles extension serving truncated file for symbolic link #202

@colindembovsky

Description

@colindembovsky

(Moving from this issue)
I have a SPA app that uses an config.json file with the following contents:

{
   "api": {
     "baseUri": "http://192.168.1.27:30081/api"
   }
}

In the Startup.cs file I configure StaticFiles:

    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
    {
      ...

      app.UseDefaultFiles();
      app.UseStaticFiles();
    }

I'm deploying the app in a docker container (FROM microsoft/aspnetcore:1.1) using Kubernetes. In the Kubernetes Pod I map a configMap volume to override the config file. Kubernetes creates a symlink in the contianer and the file contents are correct within the container:

host ~> kubectl exec -it $podname -c frontend /bin/bash
container:/app# ls -l wwwroot/config/config.json
lrwxrwxrwx 1 root root 18 Jun 13 15:30 wwwroot/config/config.json -> ..data/config.json
container:/app# cat wwwroot/config/config.json
{
    "api": {
        "baseUri": "http://kubernetes-value:30081/api"
    }
}

However, doing a curl only returns 18 bytes:

host ~> curl http://192.168.1.160:30080/config/config.json
{
    "api": {
host ~>

I think that the StaticFile is seeing the file length as 18 (the length for the symlink, which is the length of the path to the physical file: in this case, ../data/config.json which is 18 chars) and only serving that length even though the file proper is longer.

I don't think this is expected behavior - but perhaps there is some other setting that I should use for StaticFiles?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions