Skip to content

Commit 117b801

Browse files
authored
Fixed Uri and names for azure storage (#34)
1 parent 42377cd commit 117b801

7 files changed

Lines changed: 28 additions & 20 deletions

File tree

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1414
<PackageReadmeFile>README.md</PackageReadmeFile>
1515
<Product>Managed Code - Storage</Product>
16-
<Version>2.0.7</Version>
17-
<PackageVersion>2.0.7</PackageVersion>
16+
<Version>2.0.8</Version>
17+
<PackageVersion>2.0.8</PackageVersion>
1818
</PropertyGroup>
1919
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
2020
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>

ManagedCode.Storage.Aws/AWSStorage.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public override async IAsyncEnumerable<BlobMetadata> GetBlobMetadataListAsync(st
7575
Container = StorageOptions.Bucket,
7676
Uri = new Uri($"https://s3.amazonaws.com/{StorageOptions.Bucket}/{entry.Key}"),
7777
LastModified = objectMetaResponse.LastModified,
78-
CreationTime = objectMetaResponse.LastModified,
78+
CreatedOn = objectMetaResponse.LastModified,
7979
MimeType = objectMetaResponse.Headers.ContentType,
8080
Length = objectMetaResponse.Headers.ContentLength
8181
};
@@ -169,7 +169,7 @@ protected override async Task<Result<LocalFile>> DownloadInternalAsync(LocalFile
169169
Container = StorageOptions.Bucket,
170170
Uri = new Uri($"https://s3.amazonaws.com/{StorageOptions.Bucket}/{options.FullPath}"),
171171
LastModified = response.LastModified,
172-
CreationTime = response.LastModified,
172+
CreatedOn = response.LastModified,
173173
MimeType = response.Headers.ContentType,
174174
Length = response.Headers.ContentLength
175175
};
@@ -258,7 +258,7 @@ protected override async Task<Result<BlobMetadata>> GetBlobMetadataInternalAsync
258258
Container = StorageOptions.Bucket,
259259
Uri = new Uri($"https://s3.amazonaws.com/{StorageOptions.Bucket}/{options.FullPath}"),
260260
LastModified = objectMetaResponse.LastModified,
261-
CreationTime = objectMetaResponse.LastModified,
261+
CreatedOn = objectMetaResponse.LastModified,
262262
MimeType = objectMetaResponse.Headers.ContentType,
263263
Length = objectMetaResponse.Headers.ContentLength
264264
};

ManagedCode.Storage.Azure/AzureStorage.cs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@ public override async IAsyncEnumerable<BlobMetadata> GetBlobMetadataListAsync(st
6060
{
6161
var blobMetadata = new BlobMetadata
6262
{
63-
Name = blobItem.Name,
63+
FullName = blobItem.Name,
64+
Name = Path.GetFileName(blobItem.Name),
65+
Uri = new Uri(StorageClient.Uri, $"{StorageOptions.Container}/{blobItem.Name}"),
6466
Container = StorageOptions.Container,
65-
Length = blobItem.Properties.ContentLength.Value,
67+
Length = blobItem.Properties.ContentLength!.Value,
6668
Metadata = blobItem.Metadata.ToDictionary(k => k.Key, v => v.Value),
67-
MimeType = blobItem.Properties.ContentType
69+
LastModified = blobItem.Properties.LastModified!.Value,
70+
CreatedOn = blobItem.Properties.CreatedOn!.Value,
71+
MimeType = blobItem.Properties.ContentType,
6872
};
6973

7074
yield return blobMetadata;
@@ -192,15 +196,18 @@ protected override async Task<Result<LocalFile>> DownloadInternalAsync(LocalFile
192196
await EnsureContainerExist();
193197
var response = await blobClient.DownloadAsync(cancellationToken);
194198
await localFile.CopyFromStreamAsync(response.Value.Content);
199+
195200
localFile.BlobMetadata = new BlobMetadata
196201
{
197-
Metadata = response.Value.Details?.Metadata?.ToDictionary(k => k.Key, v => v.Value),
198-
MimeType = response.Value.ContentType,
199-
Length = response.Value.ContentLength,
200-
Name = blobClient.Name,
202+
FullName = blobClient.Name,
203+
Name = Path.GetFileName(blobClient.Name),
201204
Uri = blobClient.Uri,
202205
Container = blobClient.BlobContainerName,
203-
FullName = $"{blobClient.Uri}/{StorageOptions.Container}/{options.FullPath}"
206+
Length = response.Value.ContentLength,
207+
CreatedOn = response.Value.Details.LastModified,
208+
LastModified = response.Value.Details.LastModified,
209+
Metadata = response.Value.Details.Metadata.ToDictionary(k => k.Key, v => v.Value),
210+
MimeType = response.Value.ContentType
204211
};
205212

206213
return Result<LocalFile>.Succeed(localFile);
@@ -265,11 +272,12 @@ protected override async Task<Result<BlobMetadata>> GetBlobMetadataInternalAsync
265272

266273
return Result<BlobMetadata>.Succeed(new BlobMetadata
267274
{
268-
Name = blobClient.Name,
275+
FullName = blobClient.Name,
276+
Name = Path.GetFileName(blobClient.Name),
269277
Uri = blobClient.Uri,
270278
Container = blobClient.BlobContainerName,
271279
Length = properties.Value.ContentLength,
272-
CreationTime = properties.Value.CreatedOn,
280+
CreatedOn = properties.Value.CreatedOn,
273281
LastModified = properties.Value.LastModified,
274282
Metadata = properties.Value.Metadata.ToDictionary(k => k.Key, v => v.Value),
275283
MimeType = properties.Value.ContentType

ManagedCode.Storage.AzureDataLake/AzureDataLakeStorage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ protected override async Task<Result<BlobMetadata>> GetBlobMetadataInternalAsync
233233
Uri = fileClient.Uri,
234234
Container = fileClient.FileSystemName,
235235
Length = properties.Value.ContentLength,
236-
CreationTime = properties.Value.CreatedOn,
236+
CreatedOn = properties.Value.CreatedOn,
237237
LastModified = properties.Value.LastModified,
238238
Metadata = properties.Value.Metadata.ToDictionary(k => k.Key, v => v.Value),
239239
MimeType = properties.Value.ContentType

ManagedCode.Storage.Core/Models/BlobMetadata.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class BlobMetadata
1010
public Uri? Uri { get; set; }
1111
public Dictionary<string, string>? Metadata { get; set; }
1212
public DateTimeOffset LastModified { get; set; }
13-
public DateTimeOffset CreationTime { get; set; }
13+
public DateTimeOffset CreatedOn { get; set; }
1414
public string? Container { get; set; }
1515
public string? MimeType { get; set; }
1616
public long Length { get; set; }

ManagedCode.Storage.FileSystem/FileSystemStorage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ protected override async Task<Result<BlobMetadata>> GetBlobMetadataInternalAsync
166166
Name = fileInfo.Name,
167167
Uri = new Uri(Path.Combine(_path, filePath)),
168168
MimeType = MimeHelper.GetMimeType(fileInfo.Extension),
169-
CreationTime = fileInfo.CreationTimeUtc,
169+
CreatedOn = fileInfo.CreationTimeUtc,
170170
LastModified = fileInfo.LastWriteTimeUtc,
171171
Length = fileInfo.Length
172172
};

ManagedCode.Storage.Gcp/GCPStorage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public override IAsyncEnumerable<BlobMetadata> GetBlobMetadataListAsync(string?
6464
Name = x.Name,
6565
Uri = string.IsNullOrEmpty(x.MediaLink) ? null : new Uri(x.MediaLink),
6666
Container = x.Bucket,
67-
CreationTime = x.TimeCreated!.Value,
67+
CreatedOn = x.TimeCreated!.Value,
6868
LastModified = x.Updated!.Value,
6969
MimeType = x.ContentType,
7070
Length = (long) (x.Size ?? 0)
@@ -221,7 +221,7 @@ protected override async Task<Result<BlobMetadata>> GetBlobMetadataInternalAsync
221221
Name = obj.Name,
222222
Uri = string.IsNullOrEmpty(obj.MediaLink) ? null : new Uri(obj.MediaLink),
223223
Container = obj.Bucket,
224-
CreationTime = obj.TimeCreated!.Value,
224+
CreatedOn = obj.TimeCreated!.Value,
225225
LastModified = obj.Updated!.Value,
226226
MimeType = obj.ContentType,
227227
Length = (long) (obj.Size ?? 0)

0 commit comments

Comments
 (0)