FileSelector widget's bug in _update_files?

I noticed that there is something that looks like a bug to me and causes some undesired behavior (adding folder icons to file names on the RHS of the widget as if those files were directories)

edit: versions: panel==0.10.3, bokeh==2.2.3

# panel/widgets/
class FileSelector(CompositeWidget):
    def _update_files(self, event=None):
        dirs, files = scan_path(path, self.file_pattern)
        for s in selected:
            check = os.path.realpath(s) if os.path.islink(s) else s
            if os.path.isdir(check):
            elif os.path.isfile(check):

I suspect that there should be files instead of dirs in the last line of this code. Am I correct?

About my issue:
I’m trying to force file selector to accept only a single file on the RHS. I solved it in a little hacky way:

import panel as pn
files = pn.widgets.FileSelector('/files')

def callback(target, event):
    if len(target.value) > 1:
        target.value = [target.value[-1]]
    callbacks={'value': callback}


Which works as in gif below:

When I change dirs to files as mentioned in the beginning of this post, it works as expected - no folder icon is added.

@rafgonsi I wasn’t able to reproduce this with bokeh=2.2.3 and panel=0.10.3. Can you report your versions?

Oh, forgot it, sorry. They are the same as you used: panel==0.10.3, bokeh==2.2.3. Working on linux

I have even better example:

import panel as pn
files = pn.widgets.FileSelector('/files', value=["/files/file1.txt", "/files/file2.txt"])


Now, I’m pretty sure that it’s a bug. I reported this on github