Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnableDiskCache = false still save to disk #90

Open
DavidJoyal opened this issue Nov 15, 2018 · 7 comments
Open

EnableDiskCache = false still save to disk #90

DavidJoyal opened this issue Nov 15, 2018 · 7 comments

Comments

@DavidJoyal
Copy link
Contributor

When I tried to disabled the cache to disk, by adding this to my appsettings.json
"webOptimizer": { "enableDiskCache": false }
the class AssetResponse still try to save it on the disk.

I think the error come from the class AssetBuilder in the function BuildAsync on the line:
await _assetResponseCache.AddAsync(asset.Route, cacheKey, response).ConfigureAwait(false);

I think it should be
if (options.EnableDiskCache == true) { await _assetResponseCache.AddAsync(asset.Route, cacheKey, response).ConfigureAwait(false); }

Any chance you can add this line or correct this bug in an other way?

In my case, the css and js return a 500 error because my user does not have the right to create the folder and the file

Here is the error (I removed the path on my disk)
System.UnauthorizedAccessException: Access to the path '**custom path**' is denied. at System.IO.FileSystem.CreateDirectory(String fullPath) at System.IO.Directory.CreateDirectory(String path) at WebOptimizer.AssetResponseStore.AddAsync(String bucket, String cachekey, AssetResponse assetResponse) at WebOptimizer.AssetBuilder.BuildAsync(IAsset asset, HttpContext context, IWebOptimizerOptions options) at WebOptimizer.AssetMiddleware.HandleAssetAsync(HttpContext context, IAsset asset, WebOptimizerOptions options) at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext]

@DavidJoyal
Copy link
Contributor Author

Any chance you correct this @madskristensen ?

Also pinged @hellfirehd because I think he was the one who added this fonctionality?

@hellfirehd
Copy link
Contributor

hellfirehd commented Nov 21, 2018

That looks reasonable. Send a pull request and it will probably get accepted sooner. I’m running off a fork because I think this project is abandoned/dead.

@DavidJoyal
Copy link
Contributor Author

Alright, I just did that. I hope I did it right

Thank you

@peterbomers
Copy link

Is it possible to approve this merge?
We're using the Azure run from package feature, that creates a readonly wwwroot content directory.
All the first call to WebOptimizer fail (disk caching is disabled) because it's not allowed to create the directory.

@slaneyrw
Copy link

Can someone please approve this merge ?

@madskristensen
Copy link
Member

Done

@slaneyrw
Copy link

slaneyrw commented May 19, 2020

Is there going to be a new release with this fix... the latest public package still contains the bug.

... or do I need to fork this project coz it's dead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants