Skip to content

Commit

Permalink
Re-add System.Linq.Async (needs to be reverted when we upgrade .NET 1…
Browse files Browse the repository at this point in the history
…0 SDK version)
  • Loading branch information
caaavik-msft committed Feb 21, 2025
1 parent 2b3fb93 commit d52a162
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<PackageVersion Include="SixLabors.ImageSharp.Web.Providers.AWS" Version="3.1.3" />
<PackageVersion Include="StackExchange.Redis" Version="2.8.24" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
<PackageVersion Include="System.IO.Hashing" Version="8.0.0" />
<PackageVersion Include="xunit.v3" Version="1.0.0" />
<PackageVersion Include="xunit.analyzers" Version="1.18.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public async Task<ActionResult<IEnumerable<MediaFolderViewModel>>> GetFolders(st
}

var allowed = _mediaFileStore.GetDirectoryContentAsync(path)
.Where(async (e, t) => e.IsDirectory && await _authorizationService.AuthorizeAsync(User, MediaPermissions.ManageMediaFolder, (object)e.Path));
.WhereAwait(async e => e.IsDirectory && await _authorizationService.AuthorizeAsync(User, MediaPermissions.ManageMediaFolder, (object)e.Path));

return Ok(await allowed.Select(folder =>
{
Expand Down Expand Up @@ -138,7 +138,7 @@ public async Task<ActionResult<IEnumerable<object>>> GetMediaItems(string path,
var allowedExtensions = GetRequestedExtensions(extensions, false);

var allowed = _mediaFileStore.GetDirectoryContentAsync(path)
.Where(async (e, ct) =>
.WhereAwait(async e =>
!e.IsDirectory
&& (allowedExtensions.Count == 0 || allowedExtensions.Contains(Path.GetExtension(e.Path)))
&& await _authorizationService.AuthorizeAsync(User, MediaPermissions.ManageMediaFolder, (object)e.Path))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ await context.Updater.TryUpdateModelAsync(step,
private async Task<IList<MediaStoreEntryViewModel>> GetMediaStoreEntries(string path = null, MediaStoreEntryViewModel parent = null)
{
var mediaStoreEntries = await _mediaFileStore.GetDirectoryContentAsync(path)
.Select(async (FileStorage.IFileStoreEntry e, CancellationToken token) =>
.SelectAwait(async e =>
{
var mediaStoreEntry = new MediaStoreEntryViewModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<ItemGroup>
<PackageReference Include="Shortcodes" />
<PackageReference Include="SixLabors.ImageSharp.Web" />
<PackageReference Include="System.Linq.Async" />
<PackageReference Include="System.IO.Hashing" />
</ItemGroup>

Expand Down

0 comments on commit d52a162

Please sign in to comment.