occ files:scan generates an exception for .htaccess file
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- Nextcloud Server is running on 64bit capable CPU, PHP and OS.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
occ files:scan someuser generates an exception when .htaccess file is located - in this case the user copied a directory containing valid public_html/.htaccess - is there is a good reason to block user's from having .htaccess file under their own storage - even if the directory was to be shared I assume the Nextcloud code would ignore the file. If that is not the case occ files:scan should generate a proper error, and not an exception.
occ files:scan someuser
Starting scan for user 1 out of 1 (someuser)
Exception during scan: Invalid path: someuser/public_html/courses/.htaccess
#0 /var/www/nextcloud/lib/private/Files/Storage/Common.php(890): OC\Files\Storage\Common->getMetaData()
#1 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encoding.php(544): OC\Files\Storage\Common->getDirectoryContent()
#2 [internal function]: OC\Files\Storage\Wrapper\Encoding->getDirectoryContent()
#3 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(410): iterator_to_array()
#4 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(390): OC\Files\Cache\Scanner->handleChildren()
#5 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(393): OC\Files\Cache\Scanner->scanChildren()
#6 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(393): OC\Files\Cache\Scanner->scanChildren()
#7 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(393): OC\Files\Cache\Scanner->scanChildren()
#8 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(393): OC\Files\Cache\Scanner->scanChildren()
#9 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(393): OC\Files\Cache\Scanner->scanChildren()
#10 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(342): OC\Files\Cache\Scanner->scanChildren()
#11 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(256): OC\Files\Cache\Scanner->scan()
#12 /var/www/nextcloud/apps/files/lib/Command/Scan.php(144): OC\Files\Utils\Scanner->scan()
#13 /var/www/nextcloud/apps/files/lib/Command/Scan.php(200): OCA\Files\Command\Scan->scanFiles()
#14 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute()
#15 /var/www/nextcloud/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run()
#16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run()
#17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#18 /var/www/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#19 /var/www/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#20 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#21 /var/www/nextcloud/occ(11): require_once('...')
#22 {main}
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 1499 | 25174 | 00:00:23 |
+---------+-------+--------------+
Steps to reproduce
- occ files:scan
Expected behavior
occ should not generate an exception for .htaccess under user's storage directory.
Installation method
No response
Operating system
RHEL/CentOS
PHP engine version
PHP 8.0
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
No response
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
No response
List of activated Apps
Enabled:
- accessibility: 1.10.0
- activity: 2.16.0
- admin_audit: 1.14.0
- announcementcenter: 6.3.1
- apporder: 0.15.0
- bruteforcesettings: 2.4.0
- calendar: 3.5.0
- circles: 24.0.1
- cloud_federation_api: 1.7.0
- contacts: 4.2.1
- contactsinteraction: 1.5.0
- dav: 1.22.0
- extract: 1.3.5
- federatedfilesharing: 1.14.0
- federation: 1.14.0
- files: 1.19.0
- files_external: 1.16.1
- files_linkeditor: 1.1.11
- files_markdown: 2.3.6
- files_pdfviewer: 2.5.0
- files_rightclick: 1.3.0
- files_sharing: 1.16.2
- files_trashbin: 1.14.0
- files_versions: 1.17.0
- files_videoplayer: 1.13.0
- firstrunwizard: 2.13.0
- groupfolders: 12.0.1
- login_notes: 1.1.0
- logreader: 2.9.0
- lookup_server_connector: 1.12.0
- metadata: 0.16.0
- notes: 4.5.1
- notifications: 2.12.0
- oauth2: 1.12.0
- onlyoffice: 7.5.4
- password_policy: 1.14.0
- photos: 1.6.0
- polls: 3.8.0
- privacy: 1.8.0
- provisioning_api: 1.14.0
- quota_warning: 1.14.0
- recommendations: 1.3.0
- serverinfo: 1.14.0
- settings: 1.6.0
- sharebymail: 1.14.0
- tasks: 0.14.4
- text: 3.5.1
- theming: 1.15.0
- twofactor_backupcodes: 1.13.0
- twofactor_totp: 6.4.0
- updatenotification: 1.14.0
- video_converter: 1.0.5
- viewer: 1.8.0
- workflowengine: 2.6.0
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with occ files:scan <user> and a .htaccess file, then trace the exception through lib/private/Files/Storage/Common.php, lib/private/Files/Storage/Wrapper/Encoding.php, lib/private/Files/Cache/Scanner.php, and apps/files/lib/Command/Scan.php. Done means scanning user storage containing .htaccess no longer generates an exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100