Skip to content

Commit d034c29

Browse files
Update dependencies and cleanup (#392)
* Update dependencies and cleanup * Try reverting Azure version * Revert "Try reverting Azure version" This reverts commit 72681d4. * Add some debugging code * Try setting the property in the factory also
1 parent cab3cb1 commit d034c29

File tree

12 files changed

+37
-28
lines changed

12 files changed

+37
-28
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ jobs:
8888
shell: bash
8989
run: |
9090
sudo npm install -g azurite
91-
sudo azurite --loose &
91+
sudo azurite --loose --skipApiVersionCheck &
9292
9393
- name: Azurite Setup Windows
9494
if: matrix.options.os == 'windows-latest'
9595
shell: bash
9696
run: |
9797
npm install -g azurite
98-
azurite --loose &
98+
azurite --loose --skipApiVersionCheck &
9999
100100
- name: S3rver Setup
101101
if: matrix.options.os != 'windows-latest'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ On Windows to install and run the server as a background process run the followi
9090

9191
```bash
9292
npm install -g azurite
93-
start /B azurite --loose
93+
start /B azurite --loose --skipApiVersionCheck
9494

9595
npm install -g s3rver
9696
start /B s3rver -d .
@@ -100,7 +100,7 @@ On Linux
100100

101101
```bash
102102
sudo npm install -g azurite
103-
sudo azurite --loose &
103+
sudo azurite --loose --skipApiVersionCheck &
104104

105105
sudo npm install -g s3rver
106106
sudo s3rver -d . &

src/ImageSharp.Web.Providers.AWS/Caching/AWSS3StorageCache.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public Task SetAsync(string key, Stream stream, ImageCacheMetadata metadata)
6060
Key = this.GetKeyWithFolder(key),
6161
ContentType = metadata.ContentType,
6262
InputStream = stream,
63-
AutoCloseStream = false
63+
AutoCloseStream = false,
64+
UseChunkEncoding = false
6465
};
6566

6667
foreach (KeyValuePair<string, string> d in metadata.ToDictionary())
@@ -141,7 +142,7 @@ private static readonly TaskFactory TaskFactory
141142
/// <summary>
142143
/// Executes an async <see cref="Task"/> method synchronously.
143144
/// </summary>
144-
/// <param name="task">The task to excecute.</param>
145+
/// <param name="task">The task to execute.</param>
145146
public static void RunSync(Func<Task> task)
146147
{
147148
CultureInfo cultureUi = CultureInfo.CurrentUICulture;
@@ -159,7 +160,7 @@ public static void RunSync(Func<Task> task)
159160
/// a <paramref name="task"/> return type synchronously.
160161
/// </summary>
161162
/// <typeparam name="TResult">The type of result to return.</typeparam>
162-
/// <param name="task">The task to excecute.</param>
163+
/// <param name="task">The task to execute.</param>
163164
/// <returns>The <typeparamref name="TResult"/>.</returns>
164165
public static TResult RunSync<TResult>(Func<Task<TResult>> task)
165166
{

src/ImageSharp.Web.Providers.AWS/ImageSharp.Web.Providers.AWS.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</ItemGroup>
4444

4545
<ItemGroup>
46-
<PackageReference Include="AWSSDK.S3" Version="3.7.103.42" />
46+
<PackageReference Include="AWSSDK.S3" Version="4.0.6.2" />
4747
</ItemGroup>
4848

4949
<ItemGroup>

src/ImageSharp.Web.Providers.AWS/Resolvers/AWSS3StorageCacheResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public Task<ImageCacheMetadata> GetMetaDataAsync()
3838
foreach (string key in this.metadata.Keys)
3939
{
4040
// Trim automatically added x-amz-meta-
41-
dict.Add(key.Substring(11).ToUpperInvariant(), this.metadata[key]);
41+
dict.Add(key[11..].ToUpperInvariant(), this.metadata[key]);
4242
}
4343

4444
return Task.FromResult(ImageCacheMetadata.FromDictionary(dict));

src/ImageSharp.Web.Providers.AWS/Resolvers/AWSS3StorageImageResolver.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ public async Task<ImageMetadata> GetMetaDataAsync()
4949
}
5050
}
5151

52-
return new ImageMetadata(metadata.LastModified, maxAge, metadata.ContentLength);
52+
return new ImageMetadata(metadata.LastModified ?? DateTime.UtcNow, maxAge, metadata.ContentLength);
5353
}
5454

5555
/// <inheritdoc />
56-
public Task<Stream> OpenReadAsync() => this.amazonS3.GetObjectStreamAsync(this.bucketName, this.imagePath, null);
56+
public Task<Stream> OpenReadAsync()
57+
=> this.amazonS3.GetObjectStreamAsync(this.bucketName, this.imagePath, null);
5758
}

src/ImageSharp.Web.Providers.Azure/ImageSharp.Web.Providers.Azure.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<AssemblyName>SixLabors.ImageSharp.Web.Providers.Azure</AssemblyName>
@@ -43,7 +43,7 @@
4343
</ItemGroup>
4444

4545
<ItemGroup>
46-
<PackageReference Include="Azure.Storage.Blobs" Version="12.15.1" />
46+
<PackageReference Include="Azure.Storage.Blobs" Version="12.25.0" />
4747
</ItemGroup>
4848

4949
<ItemGroup>

src/ImageSharp.Web/Middleware/ImageContext.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public ImageContext(HttpContext context, ImageSharpMiddlewareOptions options)
6161
internal enum PreconditionState
6262
{
6363
/// <summary>
64-
/// Unspeciified
64+
/// Unspecified
6565
/// </summary>
6666
Unspecified,
6767

@@ -88,7 +88,7 @@ internal enum PreconditionState
8888
/// The combined components of the image request URL in a fully un-escaped form (except
8989
/// for the QueryString) suitable only for display.
9090
/// </returns>
91-
public string GetDisplayUrl() => this.request.GetDisplayUrl();
91+
public readonly string GetDisplayUrl() => this.request.GetDisplayUrl();
9292

9393
/// <summary>
9494
/// Analyzes the headers for the current request.
@@ -110,7 +110,7 @@ public void ComprehendRequestHeaders(DateTimeOffset lastModified, long length)
110110
/// Gets the preconditioned state of the request.
111111
/// </summary>
112112
/// <returns>The <see cref="PreconditionState"/>.</returns>
113-
public PreconditionState GetPreconditionState()
113+
public readonly PreconditionState GetPreconditionState()
114114
=> GetMaxPreconditionState(
115115
this.ifMatchState,
116116
this.ifNoneMatchState,
@@ -121,7 +121,7 @@ public PreconditionState GetPreconditionState()
121121
/// Gets a value indicating whether this request is a head request.
122122
/// </summary>
123123
/// <returns>THe <see cref="bool"/>.</returns>
124-
public bool IsHeadRequest()
124+
public readonly bool IsHeadRequest()
125125
=> string.Equals("HEAD", this.request.Method, StringComparison.OrdinalIgnoreCase);
126126

127127
/// <summary>
@@ -130,7 +130,7 @@ public bool IsHeadRequest()
130130
/// <param name="statusCode">The status code.</param>
131131
/// <param name="metaData">The image metadata.</param>
132132
/// <returns>The <see cref="Task"/>.</returns>
133-
public Task SendStatusAsync(int statusCode, in ImageCacheMetadata metaData)
133+
public readonly Task SendStatusAsync(int statusCode, in ImageCacheMetadata metaData)
134134
=> this.ApplyResponseHeadersAsync(
135135
statusCode,
136136
metaData.ContentType,
@@ -142,7 +142,7 @@ public Task SendStatusAsync(int statusCode, in ImageCacheMetadata metaData)
142142
/// <param name="stream">The output stream.</param>
143143
/// <param name="metaData">The image metadata.</param>
144144
/// <returns>The <see cref="Task"/>.</returns>
145-
public async Task SendAsync(Stream stream, ImageCacheMetadata metaData)
145+
public readonly async Task SendAsync(Stream stream, ImageCacheMetadata metaData)
146146
{
147147
await this.ApplyResponseHeadersAsync(
148148
ResponseConstants.Status200Ok,
@@ -176,7 +176,7 @@ private static PreconditionState GetMaxPreconditionState(params PreconditionStat
176176
return max;
177177
}
178178

179-
private async Task ApplyResponseHeadersAsync(
179+
private readonly async Task ApplyResponseHeadersAsync(
180180
int statusCode,
181181
string contentType,
182182
TimeSpan maxAge)

src/ImageSharp.Web/Middleware/ResponseConstants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace SixLabors.ImageSharp.Web.Middleware;
55

66
/// <summary>
7-
/// Contains constants related to HTTP respose codes.
7+
/// Contains constants related to HTTP response codes.
88
/// </summary>
99
internal static class ResponseConstants
1010
{

src/ImageSharp.Web/Providers/PhysicalFileSystemProvider.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public PhysicalFileSystemProvider(
3333
/// <param name="webRootPath">The web root path.</param>
3434
/// <param name="contentRootPath">The content root path.</param>
3535
/// <returns><see cref="string"/> representing the fully qualified provider root path.</returns>
36+
/// <exception cref="InvalidOperationException">
37+
/// Thrown when the provider root path cannot be determined.
38+
/// </exception>
3639
internal static string GetProviderRoot(PhysicalFileSystemProviderOptions options, string webRootPath, string contentRootPath)
3740
{
3841
string providerRootPath = options.ProviderRootPath ?? webRootPath;

0 commit comments

Comments
 (0)