Hi , @ThaarA-1424
According to your description, you are connecting the document in sharePoint ?
If this , you can try to use this:
Gallery-OnSelect:
ClearCollect(colAttach,ForAll(Table(Gallery3.Selected),{DisplayName:ThisRecord.'File name with extension', Id:ThisRecord.'File name with extension',Value:ThisRecord.'Link to item'} ));
ClearCollect(GalSelected, Gallery3.Selected );
Attachments- Items:
colAttach
As we can not get the fileContent from the Documents, so we need to add a Button-OnSelect:
Set(Attac2, Attacher.Attachments);
Set(IDItem,Value(updatethefile.Run(Gallery3.Selected.Identifier,Gallery3.Selected.hiddenFolderPath,First(Attac2).Name,First(Attac2).Value).id));
Refresh(Documents); Reset(Gallery3);
And we need to use the flow , first delete this file then create a new file . Because we do not have the replace file action in automate .

Then we can configure Gallery-Default:
If( IsBlank(LookUp(Documents,ID=Value(IDItem))) , First(Documents),LookUp(Documents,ID=IDItem) )
And for this , we can just use it for the files instead of the folders.

If I misunderstand what you mean, you can describe your needs and your expected outcomes in detail so that we can better help you.
Best Regards,
Yueyun Zhang