Skip to content

Commit

Permalink
Merge branch 'release/6.21.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vc-ci committed Jun 7, 2023
2 parents cf0f00a + 960d57b commit 40e58ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Authors>VirtoCommerce</Authors>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>6.20.0</VersionPrefix>
<VersionPrefix>6.21.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion VirtoCommerce.Storefront/Controllers/AssetController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public async Task<ActionResult> GetThemeAssets(string path)
{
var stream = await _themeEngine.GetAssetStreamAsync(path);
return stream != null
? File(stream, MimeTypes.GetMimeType(path))
? File(stream, MimeTypes.GetMimeType(path), true)
: HandleStaticFiles(path);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.FileProviders.Physical;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
using VirtoCommerce.Storefront.Model.Caching;
Expand All @@ -18,8 +17,7 @@ public class FileSystemContentBlobProvider : IContentBlobProvider
{
private readonly FileSystemBlobContentOptions _options;
private readonly IStorefrontMemoryCache _memoryCache;
// Keep links to file watchers to prevent GC to collect it
private readonly PhysicalFilesWatcher _fileSystemWatcher;
private readonly PhysicalFileProvider _physicalFileProvider;

public FileSystemContentBlobProvider(IOptions<FileSystemBlobContentOptions> options, IStorefrontMemoryCache memoryCache)
{
Expand All @@ -30,7 +28,7 @@ public FileSystemContentBlobProvider(IOptions<FileSystemBlobContentOptions> opti
{
//It is very important to have rootPath with leading slash '\' without this any changes won't reflected
var rootPath = _options.Path.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
_fileSystemWatcher = new PhysicalFilesWatcher(rootPath, new FileSystemWatcher(rootPath), false);
_physicalFileProvider = new PhysicalFileProvider(rootPath);
}
}
#region IContentBlobProvider Members
Expand Down Expand Up @@ -118,19 +116,12 @@ public virtual IEnumerable<string> Search(string path, string searchPattern, boo

public virtual IChangeToken Watch(string path)
{
if (_fileSystemWatcher != null)
if (_physicalFileProvider == null)
{
// Absolute paths not permitted for watcher, need to convert it to relative
if (Path.IsPathRooted(path))
{
path = GetRelativePath(path).TrimStart('/');
}
return _fileSystemWatcher.CreateFileChangeToken(path);
}
else
{
return new CancellationChangeToken(new CancellationToken());
return NullChangeToken.Singleton;
}

return _physicalFileProvider.Watch(path);
}
#endregion

Expand Down

0 comments on commit 40e58ad

Please sign in to comment.