Open ZweiEuro opened 1 month ago
That would keep .git dirs, but wouldn't that still remove the .gitignore files?
Well yes, but i wouldn't expect someone to put your index.php directly into another repo/submodule. I think that would be a bad idea in general, but yes my code only filters out files starting with dot.
But you could easily adapt this to filter out anything starting with '.' just by removing && !is_dir
statement
on line 404:
if ($file != '.' && $file != '..' && !in_array(strtolower(pathinfo($file, PATHINFO_EXTENSION)), $notAllowedExtensions))
I thought it was already excluding anything starting with . (files or dirs) and .. (so you cant navigate back the root folder), didnt really check if that was working since it was for the extensions array >.<
I added that to hide the hidden files now and the folders are kept, thanks =)
Actually, adding that line did the trick only for files in the root directory, but it also made the script stop showing inner subfolders for some reason. I reverted the file back.
I am guessing you checked the relative path of for a dot at the start, which will be true for every path. If you open a branch with the bug you describe i can take a look at it
For me its a quite common use-case to commit a general structure for directories even if they are empty with
.gitkeep
files or.gitignore
files.I'd suggest puttting this block:
Right after listing all directories's files at https://github.com/surtarso/single-file-php-file-browser/blob/f6986022437e10b5465ae69bd635378d0ce4f46e/index.php#L398
But since I understand that's just flavor and not general I just wrote it as an issue and not a PR.