Skip to content

Commit

Permalink
Aws fix (#20)
Browse files Browse the repository at this point in the history
* changed upload method

* fixed AWS get method

* changed version to 1.0.0

Co-authored-by: Ruslan Dudchenko <rusland@managed-code.com>
  • Loading branch information
dudchenko610 and Ruslan Dudchenko authored Mar 23, 2022
1 parent 179c6fa commit ebc4227
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Product>Managed Code - Storage</Product>
<Version>0.1.0</Version>
<PackageVersion>0.1.0</PackageVersion>
<Version>1.0.0</Version>
<PackageVersion>1.0.0</PackageVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
Expand Down
23 changes: 3 additions & 20 deletions ManagedCode.Storage.Aws/AWSStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,28 +149,12 @@ public async Task<BlobMetadata> GetBlobAsync(string blobName, CancellationToken
};

var objectMetaResponse = await _s3Client.GetObjectMetadataAsync(objectMetaRequest);

var objectAclRequest = new GetACLRequest
{
BucketName = _bucket,
Key = blobName
};

var objectAclResponse = await _s3Client.GetACLAsync(objectAclRequest);
var isPublic = objectAclResponse.AccessControlList.Grants.Any(x => x.Grantee.URI == "http://acs.amazonaws.com/groups/global/AllUsers");


return new BlobMetadata
{
Name = blobName,
//Container = containerName,
//Length = objectMetaResponse.Headers.ContentLength,
//ETag = objectMetaResponse.ETag,
//ContentMD5 = objectMetaResponse.ETag,
//ContentType = objectMetaResponse.Headers.ContentType,
//ContentDisposition = objectMetaResponse.Headers.ContentDisposition,
//LastModified = objectMetaResponse.LastModified,
//Security = isPublic ? BlobSecurity.Public : BlobSecurity.Private,
//Metadata = objectMetaResponse.Metadata.ToMetadata(),
Uri = new Uri($"https://s3.amazonaws.com/{_bucket}/{blobName}"),
ContentType = objectMetaResponse.Headers.ContentType
};
}

Expand Down Expand Up @@ -263,7 +247,6 @@ public async Task UploadFileAsync(string blobName, string pathToFile, Cancellati
}
}


public async Task UploadFileAsync(BlobMetadata blobMetadata, string pathToFile, CancellationToken cancellationToken = default)
{
using (var fs = new FileStream(pathToFile, FileMode.Open, FileAccess.Read))
Expand Down

0 comments on commit ebc4227

Please sign in to comment.