Shared file not accessible by other users if inside folder

I have this very funny situation that I cannot really wrap my head around.

Case1

  • User A creates a file in the home, shares it with everyone
  • User B can see and access the file

Case2

  • User A creates a file in a sub-folder of the home, shares it with everyone
  • User B cannot even see the file in the file manager

I can’t seem to find any way in the UI to customize permissions for folders, so I am assuming that folders are readable by default.

Anyways, I am a developer too, so I dug into the code trying to find where the file list is generated, but the code-base is too large and couldn’t find it. Any clues on where I should start looking or on what is wrong?

I really think the “bug” (if it can be considered such) is in the way permissions are managed for folders.

I found out that I can assign folder permissions using the administrator user, but I cannot change folder permissions with a normal user, even if it is the owner of the folder.

Also, even if the files themselves are accessible from User B (as shown in the following snippet) since the folders are not, nothing shows up in the file manager. This is expected, but it is rather unexpected that User A wouldn’t be able to control permissions on its own folders.

frappe.db.get_list('File', null, {is_folder:'True'}).then(
    function(records){
        for(i=0;i<records.length;++i)
        {
            record = records[i];
            frappe.db.get_doc('File', record.name, {}).then(
                function(doc){
                    console.log(["DocName: "+ doc.name, "Filename: "+doc.file_name, "Folder: "+doc.folder, "IsFolder: "+ doc.is_folder].join(", "));
                }
            )
        }
    })
[object Promise]: {}
DocName: 3867207b7f, Filename: One Asset Logo.svg, Folder: Home/Attachments, IsFolder: 0
DocName: 2fbef9f1d4, Filename: Welcome to Wordd5de84.docx, Folder: Home/Test, IsFolder: 0
DocName: cb631b79a0, Filename: Welcome to Hwp.hwp, Folder: Home, IsFolder: 0