I'm not sure if this is a bug or a feature request. I would like to only display some specific file types (e.g. pdf only), but also list subdirectories. Setting the whitelist to:

*.pdf

automatically hides subdirectories, which is not the desired behavior. Whitelisting all subdirectories is not an option, because there are too many of them. Could we set the policy so that listing subdirectories takes precedence over the whitelist, and only hide those which are explicitly blacklisted? I also tried to whitelist:

[^\.]+
*.pdf

but [^\.]+ fails to catch subdirectories.

CommentFileSizeAuthor
#4 patch_2832570.diff961 byteslpsolit

Comments

LpSolit created an issue. See original summary.

clivesj’s picture

I can't imagine this is intended behaviour.
We can solve it by *not* sending the directories to the Whitelist validator.
We can do that in ServerFileList::createServerFileList which is easier than in the the validator itsself because we need the path_to_file to check if it is a directory.
I will come back on this shortly, or if you have time: go-ahead.

lpsolit’s picture

Assigned: Unassigned » lpsolit

I have a patch ready. I will upload it in a minute or two.

lpsolit’s picture

Status: Active » Needs review
StatusFileSize
new961 bytes

While fixing this bug, I found another more severe issue: filetype() returns 'dir' for directories, not 'directory'. So the check to hide subdirectories was always wrong, meaning that subdirectories were always displayed independently of the exploreSubdirs value. I fixed this issue as part of this patch.

clivesj’s picture

Status: Needs review » Fixed

Thanks for the patch. Committed to dev. Realease will follow soon

  • clivesj committed 3a0b6dc on 8.x-2.x authored by LpSolit
    Issue #2832570 by LpSolit: The whitelist is incompatible with listing...
clivesj’s picture

Status: Fixed » Closed (fixed)