Hello,
https://docs.abp.io/en/abp/latest/Blob-Storing-Azure#options
I would like to know if it's possible to remove the "host" string and directly use the blob name as the path under the container. (My current tenant is null)
Now: test1(container name)/host/data/test.pdf Expect: test2(container name)/data/test.pdf
Thanks.
- ABP Framework version: v7.1.1
- UI Type: Flutter
- Database System: EF Core (SQL Server) / MongoDB
- Tiered (for MVC) or Auth Server Separated (for Angular):
- Exception message and full stack trace:
- Steps to reproduce the issue:
5 Answer(s)
-
0
hi
You can override the
DefaultAzureBlobNameCalculator
service.https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/DefaultAzureBlobNameCalculator.cs#L18
-
0
hi
I wrote the following code to override the DefaultAzureBlobNameCalculator service, but it cannot enter the TestBlobNameCalculator/Calculate.
And throw error "Could not found the requested BLOB 'test.pdf' in the container 'TestContainer'!".
Did I miss something?
public class TestBlobNameCalculator : DefaultAzureBlobNameCalculator { public TestBlobNameCalculator(ICurrentTenant currentTenant) : base(currentTenant) { } public override string Calculate(BlobProviderArgs args) { if (args.ContainerName == "testContainer") {c return args.BlobName; } return base.Calculate(args); } }
-
0
hi
And throw error "Could not found the requested BLOB 'test.pdf' in the container 'TestContainer'!".
Please share the full error stack. Thanks.
-
0
I found a solution.
https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-Services#overriding-a-service-class
-
0
Great!