Hello @clivesj,
I'm reopening this issue since I can reproduce this issue on my Drupal 10 Website.
Here is the error on the command line:
Uncaught PHP Exception Drupal\\Core\\File\\Exception\\NotRegularDirectoryException: "public://my_files/organism_1/collection1/nothing.txt is not a directory." at /var/www/t4/web/core/lib/Drupal/Core/File/FileSystem.php line 668, referer: http://t4.bigrig.local/node/1?fid=8
Here are the logs showing the error:
php
Date Thursday, August 1, 2024 - 15:08
User drupaladmin
Location http://localhost/tripal4/node/1?fid=42
Referrer http://localhost/tripal4/node/1
Message Drupal\Core\File\Exception\NotRegularDirectoryException: public://uploads/example-link.txt is not a directory. in Drupal\Core\File\FileSystem->scanDirectory() (line 646 of /var/www/tripal4/web/core/lib/Drupal/Core/File/FileSystem.php).
Severity Error
Hostname ::1
Operations
Backtrace
#0 /var/www/tripal4/web/modules/contrib/filebrowser/src/ServerFileList.php(72): Drupal\Core\File\FileSystem->scanDirectory()
#1 /var/www/tripal4/web/modules/contrib/filebrowser/src/ServerFileList.php(42): Drupal\filebrowser\ServerFileList->createServerFileList()
#2 /var/www/tripal4/web/modules/contrib/filebrowser/src/File/DisplayFileList.php(180): Drupal\filebrowser\ServerFileList->__construct()
#3 /var/www/tripal4/web/modules/contrib/filebrowser/src/File/DisplayFileList.php(116): Drupal\filebrowser\File\DisplayFileList->createFileDisplayList()
#4 /var/www/tripal4/web/modules/contrib/filebrowser/filebrowser.module(241): Drupal\filebrowser\File\DisplayFileList->__construct()
#5 [internal function]: filebrowser_node_view()
#6 /var/www/tripal4/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): call_user_func_array()
#7 /var/www/tripal4/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(395): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
#8 /var/www/tripal4/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(423): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#9 /var/www/tripal4/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(288): Drupal\Core\Extension\ModuleHandler->invokeAll()
#10 /var/www/tripal4/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(239): Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
#11 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build()
#12 /var/www/tripal4/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#13 /var/www/tripal4/web/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
#14 /var/www/tripal4/web/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
#15 /var/www/tripal4/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#16 /var/www/tripal4/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render()
#17 /var/www/tripal4/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#18 /var/www/tripal4/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(239): Drupal\Core\Render\Renderer->executeInRenderContext()
#19 /var/www/tripal4/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#20 /var/www/tripal4/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#21 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#22 /var/www/tripal4/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#23 /var/www/tripal4/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#24 /var/www/tripal4/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#25 /var/www/tripal4/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#26 /var/www/tripal4/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#27 /var/www/tripal4/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#28 /var/www/tripal4/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#29 /var/www/tripal4/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#30 /var/www/tripal4/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#31 /var/www/tripal4/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#32 /var/www/tripal4/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#33 /var/www/tripal4/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#34 /var/www/tripal4/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#35 /var/www/tripal4/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#36 /var/www/tripal4/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#37 {main}
The log entry you're seeing indicates that Drupal is encountering an issue with handling symbolic links as if they are directories.
Here are the steps on how to replicate this issue:
On Windows (Using Ubuntu Subsystem) - I have a file example.txt in C:\test\symbolic
Create a Symbolic Link in Ubuntu Subsystem:
Open your Ubuntu terminal (the WSL terminal).
Mount your Windows drive if it's not already mounted. Itβs usually mounted under /mnt/, so C: is accessible at /mnt/c/.
Create a symbolic link in the Ubuntu filesystem pointing to your Windows file. Run:
sudo ln -s /mnt/c/test/symbolic/example.txt /var/www/tripal4/web/sites/default/files/uploads/example-link.txt
This command creates a symbolic link named example-link.txt in the Filebrowser directory (/var/www/tripal4/web/sites/default/files/uploads) that points to example.txt located on your Windows drive.
After creating these commands and ensure the symbolic link is shown on the FileBrowser module content you created, if you want to download rthe symbolic link, it will show an error.
I believe the php file: filebrowser/src/ServerFileList.php - needs to be updated to clear this issue.
Would you please take a look when you have some time?
Thank you so much!
binquanwang β created an issue.