Based on the example in the memory file system minification example, I have tried to inject my own files into the MemFS and inserted at index 0 like in the sample, but whenever I try to fetch those files I get a Forbidden error with this:
memFs.WriteFile("mypath", text);
existingProviders.Insert(0, memFs);
{"Bytes to be written to the stream exceed the Content-Length bytes size specified."}
I have tried adding a RawHTTPHandler
and returning this return new ServiceStack.Host.Handlers.StaticFileHandler(VirtualFileSources.GetFile(url));
but with the same result.
Very surprised that it wasn’t returned ok just from the get-go. I had to add this:
var vf = VirtualFileSources.GetFile(url);
return new ServiceStack.Host.Handlers.StaticFileHandler { VirtualNode = vf, BufferSize = vf.ReadAllBytes().Length };
to return the file, but even there I’m getting errors related to the length not aligning correctly. What am I doing wrong?
Also, doing this for html files drops the “auto append” html/cshtml feature in paths.