Browse Source
Merge pull request #7961 from abpframework/cms-kit/fix-media-upload
CmsKit - Fix MediaDescriptor mismatching Id
pull/7962/head
Ahmet Çotur
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
2 deletions
-
modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs
|
|
@ -35,12 +35,11 @@ namespace Volo.CmsKit.Admin.MediaDescriptors |
|
|
|
|
|
|
|
|
await CheckAnyOfPoliciesAsync(definition.CreatePolicies); |
|
|
await CheckAnyOfPoliciesAsync(definition.CreatePolicies); |
|
|
|
|
|
|
|
|
var newId = GuidGenerator.Create(); |
|
|
|
|
|
using (var stream = inputStream.GetStream()) |
|
|
using (var stream = inputStream.GetStream()) |
|
|
{ |
|
|
{ |
|
|
var newEntity = await MediaDescriptorManager.CreateAsync(inputStream.EntityType, inputStream.Name, inputStream.ContentType, inputStream.ContentLength ?? 0); |
|
|
var newEntity = await MediaDescriptorManager.CreateAsync(inputStream.EntityType, inputStream.Name, inputStream.ContentType, inputStream.ContentLength ?? 0); |
|
|
|
|
|
|
|
|
await MediaContainer.SaveAsync(newId.ToString(), stream); |
|
|
await MediaContainer.SaveAsync(newEntity.Id.ToString(), stream); |
|
|
await MediaDescriptorRepository.InsertAsync(newEntity); |
|
|
await MediaDescriptorRepository.InsertAsync(newEntity); |
|
|
|
|
|
|
|
|
return ObjectMapper.Map<MediaDescriptor, MediaDescriptorDto>(newEntity); |
|
|
return ObjectMapper.Map<MediaDescriptor, MediaDescriptorDto>(newEntity); |
|
|
|