BLACK FRIDAY
From November 21
to December 01
99Days : 99Hrs : 99Min : 99Sec
SAVE UP TO$3K
Also valid for the
existing customers!
Open Closed

FileManager won't create file when no ExtensibleObject is passed #3116


0
cezary.bojko created
  • ABP Framework version: v5.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
at Volo.Abp.Check.NotNull[T](T value, String parameterName)
   at Volo.Abp.ObjectExtending.ExtensibleObjectMapper.MapExtraPropertiesTo[TSource,TDestination](TSource source, TDestination destination, Nullable`1 definitionChecks, String[] ignoredProperties)
   at Volo.Abp.ObjectExtending.HasExtraPropertiesObjectExtendingExtensions.MapExtraPropertiesTo[TSource,TDestination](TSource source, TDestination destination, Nullable`1 definitionChecks, String[] ignoredProperties)
   at Volo.FileManagement.Files.FileManager.<SaveFileDescriptorAsync>d__12.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Volo.FileManagement.Files.FileManager.&lt;CreateAsync&gt;d__11.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
  • Steps to reproduce the issue:"

After update from 5.1.4 to 5.2.2 I must pass optional parameter (extensibleObject) to avoid exception.

        await _fileManager.CreateAsync(errorFileName, "text/plain", new RemoteStreamContent(stream), directoryId, extensibleObject: new ExtensibleObject());

4 Answer(s)
  • 0
    maliming created
    Support Team

    hi

    I will check this.

  • 0
    maliming created
    Support Team

    Please try to override the SaveFileDescriptorAsync of Volo.FileManagement.Files.FileManager service

    protected override async Task<FileDescriptor> SaveFileDescriptorAsync(string name, string mimeType, int contentLength, Guid? directoryId, Guid? tenantId, bool overrideExisting, ExtensibleObject extensibleObject = null)
    {
        var fileDescriptor = await FileDescriptorRepository.FindAsync(name, directoryId);
    
        if (fileDescriptor != null)
        {
            if (!overrideExisting)
            {
                throw new FileAlreadyExistException(name);
            }
    
            fileDescriptor.Size = contentLength;
            extensibleObject?.MapExtraPropertiesTo(fileDescriptor);
            await FileDescriptorRepository.UpdateAsync(fileDescriptor);
        }
        else
        {
            fileDescriptor =
                new FileDescriptor(GuidGenerator.Create(), name, mimeType, directoryId, contentLength, tenantId);
            extensibleObject?.MapExtraPropertiesTo(fileDescriptor);
            await FileDescriptorRepository.InsertAsync(fileDescriptor);
        }
    
        return fileDescriptor;
    }
    
  • 0
    cezary.bojko created

    So, is this a bug? Could I get question refund?

  • 0
    maliming created
    Support Team

    Refunded : )