Bug in File Manager Flat Data Example

Hi

There is an error in the File Manager Flat Data example.

Please see:

https://blazor.syncfusion.com/demos/file-manager/flat-data?theme=bootstrap5 

When an new Folder is added just beneath the root folder "Files" the FilterId and the FilterPath are set incorrectly.

In FileManagerService.CreateAsync(..) FilterId must be set to "0/" instead of "/" and FilterPath to "/" instead of "<name>/"

In FileManagerService.ReadAsync(...) the if clause "string.IsNUllOrEmpty(id)" can be removed if the above error is corrected.

What do you think about it?

Best regards, Bruno


  


6 Replies

PS Praveen Sellappan Syncfusion Team February 16, 2026 05:01 PM UTC

Hi Bruno,


Greetings from Syncfusion Support.


Regarding the issue where the path appears as "0/" instead of "/" when creating a folder:


Based on the information provided, we have validated and classified the reported scenarios regarding the “Incorrect path appears while creating folder in File Manager" as a bug on our end. The fix for this issue will be included in the upcoming weekly release scheduled for March 3, 2026.


You can track the status of the fix through the following Task link.


Incorrect path occurs in Blazor file manager when creating folder in the root location in Blazor | Feedback Portal


Disclaimer:
Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.


Regarding the request to have FilterPath show "/" instead of "<name>/" for the root folder:


The purpose of the FilterPath property in the FileManagerDirectoryContent class is to represent the directory path of a file or folder relative to the root directory.


  • For items inside subfolders, it correctly shows the relative path (e.g., "/MyFolder/").
  • For items directly in the root, the current behavior was returning the folder name followed by "/" (e.g., "RootFolder/"), which is inconsistent with the expected root-relative representation of simply "/".


Following your suggestion, we have updated the FlatData CreateAsync method in our service layer so that:


  • For the root folder, FilterPath now returns only "/".
  • For all other locations (subfolders), it continues to return the current relative path format.


We have attached the updated sample incorporating this change for your reference. Kindly review the sample, test the folder creation and navigation behavior, and let us know if this addresses your requirement fully.


Code Snippet:


public async Task<FileManagerResponse<FileManagerDirectoryContent>> CreateAsync(string path, string name, FileManagerDirectoryContent fileDetails)

{

    ………

    string filterpath;

    if(path =="0/")

    {

        filterpath = "/";

    }

    else

    {

        filterpath = fileDetails.FilterPath + fileDetails.Name + "/";

    }

    newFolder.Add(new FileManagerDirectoryContent()

    {

        ………

        FilterPath =  filterpath,

        FilterId = path,

        IsFile = false,

    });

………..

}



If you observe any remaining inconsistencies or have additional feedback after testing, please feel free to share. We are happy to refine it further.


Please let us know how the sample works for you or if you need any other assistance.


Regards,

Praveen Sellappan


Attachment: sample_b02dc77b.zip


BR Bruno February 16, 2026 06:44 PM UTC

You should check on path == "/" and not path = "0/"

FilterId is also wrong.


My code that worked for me is as follows:

public async Task<FileManagerResponse<FileManagerDirectoryContent>> CreateAsync(string path, string name, FileManagerDirectoryContent fileDetails)
{
    FileManagerResponse<FileManagerDirectoryContent> response = new FileManagerResponse<FileManagerDirectoryContent>();
    List<FileManagerDirectoryContent> newFolder = new List<FileManagerDirectoryContent>();
    int idValue = Data.Select(x => x).Select(x => x.Id).ToArray().Select(int.Parse).ToArray().Max();
    await Task.Yield();
    newFolder.Add(new FileManagerDirectoryContent()
    {
        Id = (idValue + 1).ToString(),
        Name = name,
        Size = 0,
        DateCreated = DateTime.Now,
        DateModified = DateTime.Now,
        Type = "",
        ParentId = fileDetails.Id,
        HasChild = false,
        FilterPath = fileDetails.FilterPath + fileDetails.Name + "/",
        FilterId = path,
        IsFile = false,
    });

    // !!!! Error when new folder created in root folder, because of filterId and filterPath value. So added condition to avoid that issue.
    if (path == "/")
    {
        newFolder[0].FilterId = "0/";       // org = "/"  >> 0 missing
        newFolder[0].FilterPath = "/";      // org = "name/" >> remove name
    }

    response.Files = newFolder;
    Data.AddRange(newFolder);
    Data.Select(x => x).Where(x => x.Id == fileDetails.Id).FirstOrDefault().HasChild = true;
    return await Task.FromResult(response);
}






PS Praveen Sellappan Syncfusion Team February 17, 2026 02:33 PM UTC

Hi Bruno,


Thank you for the update and for sharing your working code.


For the ID-based provider, we use FilterId to represent the ID hierarchy, this is how the current implementation works. You can use the suggestion we shared. We will address the path inconsistency as promised and notify you when it is resolved.


If you encounter any issues with hierarchy IDs or filterId, please share the details so we can investigate.


Regards,

Praveen Sellappan



PS Praveen Sellappan Syncfusion Team March 11, 2026 12:17 PM UTC

Hi Bruno,

 

We regret to inform you that we were unable to include the fix for the reported issue ("Incorrect path appears while creating folder in File Manager") in our latest weekly patch release as previously scheduled.

 

During development, we encountered unexpected complexities regarding path maintenance across the component that require additional time to resolve properly. To ensure the solution is robust and of high quality, we have rescheduled the fix for our next weekly patch release, currently planned for March 24, 2026.

 

We sincerely apologize for the delay and any inconvenience this may cause to your development timeline. We appreciate your continued patience as we work to resolve this correctly.


Regards,

Praveen Sellappan



PS Praveen Sellappan Syncfusion Team March 25, 2026 02:58 PM UTC

Hi Bruno,

 

We regret to inform you that we were unable to include the fix for the reported issue (“Incorrect path appears while creating folder in File Manager") in the weekly patch release as previously promised. However, we are pleased to inform that the fix has now been planned to include in our upcoming weekly patch release scheduled for March31, 2026.

  

 Thank you for your patience and understanding.



PS Praveen Sellappan Syncfusion Team April 1, 2026 09:08 AM UTC

Hi Bruno,

Thanks for your patience.

We are glad to announce that our weekly patch release 33.1.46 has been rolled out successfully. The issue where Incorrect path appears while creating folder in File Manager has been resolved in that release itself. To access this fix, we suggest you update the package to the latest version (33.1.46). We include the workable sample for your reference.

Sample: Attached as zip.

Feedback: Incorrect path occurs in Blazor file manager when creating folder in the root location in Blazor | Feedback Portal       

Root Cause:  The folder creation logic previously failed to normalize the path for ID-based (Flat Data) systems. On the initial load, the system uses "/" as the root path, which works for path-based systems but not for ID systems that require a specific format like "0/". Consequently, creating a root folder sent the wrong identifier ("/") instead of the expected ID ("0/").


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Regards,

Praveen Sellappan



Attachment: sample_a38cc08f.zip

Loader.
Up arrow icon