Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Internal server error when trying to access non-existent file #42418

Closed
5 of 8 tasks
levinuss opened this issue Dec 21, 2023 · 2 comments · Fixed by #42427
Closed
5 of 8 tasks

[Bug]: Internal server error when trying to access non-existent file #42418

levinuss opened this issue Dec 21, 2023 · 2 comments · Fixed by #42427

Comments

@levinuss
Copy link

⚠️ This issue respects the following points: ⚠️

Bug description

When a user tries to access a non existent file (e.g. via an old bookmark) the server throws an internal server error instead of showing a human-readable error (like "This file does not exist").

Steps to reproduce

  1. Try to access non-existent file with fileid parameter in URL (e.g. https://nextcloud.example.com/apps/files?dir=/foo/bar&fileid=42)

Expected behavior

Show "This file does not exist" error (like when accessing a non-existent directory).

Installation method

Community Manual installation with Archive

Nextcloud Server version

28

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

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

{                                                                                                                                                                                            
    "system": {                                                                                                                                                                              
        "instanceid": "***REMOVED SENSITIVE VALUE***",                                                                                                                                       
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",                                                                                                                                     
        "secret": "***REMOVED SENSITIVE VALUE***",                                                                                                                                           
        "trusted_domains": [                                                                                                                                                                 
            "..."                                                                                                                                                           
        ],                                                                                                                                                                                   
        "datadirectory": "***REMOVED SENSITIVE VALUE***",                                                                                                                                    
        "dbtype": "mysql",                                                                    
        "version": "28.0.0.11",                                                                                                                                                              
        "overwrite.cli.url": "...",                                                                                                                               
        "dbname": "***REMOVED SENSITIVE VALUE***",                                                                                                                                           
        "dbhost": "***REMOVED SENSITIVE VALUE***",                                                                                                                                           
        "dbport": "",                                                                                                                                                                        
        "dbtableprefix": "oc_",                                                                                                                                                              
        "mysql.utf8mb4": true,                                                                                                                                                               
        "dbuser": "***REMOVED SENSITIVE VALUE***",                                                                                                                                           
        "dbpassword": "***REMOVED SENSITIVE VALUE***",                                                                                                                                       
        "installed": true,                                                                                                                                                                   
        "activity_expire_days": 14,                                                                                                                                                          
        "auth.bruteforce.protection.enabled": true,                                                                                                                                          
        "blacklisted_files": [                                                                                                                                                               
            ".htaccess",                                                                                                                                                                     
            "Thumbs.db",                                                                                                                                                                     
            "thumbs.db"                                                                                                                                                                      
        ],                                                                                                                                                                                   
        "cron_log": true,        
        "social_login_auto_redirect": true,                                                                                                                                                  
        "overwriteprotocol": "https",                                                                                                                                                        
        "enable_previews": true,                                                                                                                                                             
        "enabledPreviewProviders": [                                                                                                                                                         
            "OC\\Preview\\PNG",                                                                                                                                                              
            "OC\\Preview\\JPEG",                                                                                                                                                             
            "OC\\Preview\\GIF",                                                                                                                                                              
            "OC\\Preview\\BMP",                                                                                                                                                              
            "OC\\Preview\\XBitmap",                                                                                                                                                          
            "OC\\Preview\\Movie",                                                                                                                                                            
            "OC\\Preview\\PDF",                                                                                                                                                              
            "OC\\Preview\\MP3",                                                                                                                                                              
            "OC\\Preview\\TXT",                                                                                                                                                              
            "OC\\Preview\\MarkDown"                                                                                                                                                          
        ],                                                                                    
        "filesystem_check_changes": 0,
        "filelocking.enabled": "true",
        "filelocking.ttl": 3600,
        "htaccess.RewriteBase": "\/",
        "integrity.check.disabled": false,                                                                                                                                                   
        "knowledgebaseenabled": false,                                                                                                                                                       
        "logfile": "\/var\/nc_data\/nextcloud.log",                                                                                                                                          
        "loglevel": 2,                                                                                                                                                                       
        "logtimezone": "Europe\/Berlin",                                                                                                                                                     
        "log_rotate_size": 104857600,                                                                                                                                                        
        "maintenance": false,                                                                                                                                                                
        "memcache.local": "\\OC\\Memcache\\Redis",                                                                                                                                           
        "memcache.distributed": "\\OC\\Memcache\\Redis",                                                                                                                                     
        "memcache.locking": "\\OC\\Memcache\\Redis",                                                                                                                                         
        "preview_max_x": 1024,                                                                                                                                                               
        "preview_max_y": 768,                                                                                                                                                                
        "preview_max_scale_factor": 1,                                                                                                                                                       
        "redis": {                                                                                                                                                                           
            "host": "***REMOVED SENSITIVE VALUE***",                                                                                                                                         
            "port": 0,                                                                                                                                                                       
            "timeout": 0                                                                                                                                                                     
        },                                                                                    
        "quota_include_external_storage": false,                                                                                                                                             
        "share_folder": "\/Shares",                                                                                                                                                          
        "skeletondirectory": "",                                                                                                                                                             
        "theme": "",                                                                                                                                                                         
        "default_phone_region": "DE",                                                                                                                                                        
        "trashbin_retention_obligation": "30, 35",                                                                                                                                           
        "updater.release.channel": "stable",                                                                                                                                                 
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",                                                                                                                                
        "mail_smtpmode": "smtp",                                                                                                                                                             
        "mail_sendmailmode": "smtp",                                                                                                                                                         
        "mail_domain": "***REMOVED SENSITIVE VALUE***",                                                                                                                                      
        "mail_smtpsecure": "ssl",                                                                                                                                                            
        "mail_smtpport": "465",                                                                                                                                                              
        "mail_smtpauthtype": "PLAIN",                                                                                                                                                        
        "mail_smtpauth": 1,                                                                                                                                                                  
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",                                                                                                                                    
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",                                                                                                                                
        "data-fingerprint": "e8d5e5acd8b144a79ddc2482aae2d74c",
        "app_install_overwrite": [                                                                                                                                                           
            "richdocumentscode"                                                                                                                                                              
        ]                                                                                                                                                                                    
    }                                                                                                                                                                                        
}

List of activated Apps

Enabled:                             
  - admin_audit: 1.18.0                  
  - bruteforcesettings: 2.8.0
  - calendar: 4.6.0                           
  - circles: 28.0.0-dev                     
  - cloud_federation_api: 1.11.0           
  - comments: 1.18.0               
  - dav: 1.29.1                             
  - deck: 1.12.0                          
  - federatedfilesharing: 1.18.0        
  - files: 2.0.0                           
  - files_fulltextsearch: 28.0.0
  - files_pdfviewer: 2.9.0               
  - files_reminders: 1.1.0       
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0              
  - files_versions: 1.21.0                 
  - forms: 4.0.0                  
  - fulltextsearch: 28.0.0
  - groupfolders: 16.0.1
  - groupquota: 0.1.12
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - memegen: 1.0.6
  - nextcloud_announcements: 1.17.0
  - oauth2: 1.16.3
  - password_policy: 1.18.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - related_resources: 1.3.0
  - richdocuments: 8.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.0
  - sociallogin: 5.6.0
  - support: 1.11.0
  - tasks: 0.15.0
  - text: 3.9.1
  - theming: 2.3.0
  - theming_customcss: 1.15.0
  - twofactor_backupcodes: 1.17.0
  - updatenotification: 1.18.0
  - viewer: 2.2.0
  - workflowengine: 2.10.0
Disabled:
  - activity: 2.20.0 (installed 2.13.1)
  - contactsinteraction: 1.9.0 (installed 1.1.0)
  - dashboard: 7.8.0 (installed 7.0.0)
  - drawio: 2.1.4 (installed 2.1.4)
  - encryption: 2.16.0
  - external: 5.3.1 (installed 5.3.1)
  - federation: 1.18.0 (installed 1.10.1)
  - files_external: 1.20.0
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - firstrunwizard: 2.17.0 (installed 2.8.0)
  - notifications: 2.16.0 (installed 2.8.0)
  - photos: 2.4.0 (installed 1.2.0)
  - recommendations: 2.0.0 (installed 0.8.0)
  - sharebymail: 1.18.0 (installed 1.10.0)
  - side_menu: 3.11.2 (installed 3.11.2)
  - survey_client: 1.16.0 (installed 1.7.0)
  - suspicious_login: 6.0.0
  - systemtags: 1.18.0 (installed 1.10.0)
  - twofactor_totp: 10.0.0-beta.2
  - user_ldap: 1.19.0
  - user_status: 1.8.1 (installed 1.0.0)
  - weather_status: 1.8.0 (installed 1.0.0)

Nextcloud Signing status

Array
(
    [core] => Array
        (
            [INVALID_HASH] => Array
                (
                    [core/js/mimetypelist.js] => Array
                        (
                            [expected] => 550ab566d30693bfa24ec4b15d9df87731ae8a3be8f79dabf94757e5b8b20eec6e4b678f17af1718297f2872f6b04519eeb024d1dff11947f29da431c7f11201
                            [current] => 24e6faa4a1361e51ff70027024f41c4b37fdb5f6f347ceb095450ddbde2d0a6b6dd1403be92a912d2889064a9736a9bed89d7dc62470035fc1299d4b977c5f46
                        )

                )

        )

)

Nextcloud Logs

{"reqId":"sfsrA8pYiv5usPBvGnGW","level":3,"time":"2023-12-21T11:20:05+01:00","remoteAddr":"...","user":"Keycloak-...","app":"PHP","method":"GET","url":"/apps/files/?dir=/Shares/something&fileid=63","message":"Undefined array key 0 at /var/www/nextcloud/apps/files/lib/Controller/ViewController.php#240","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0","version":"28.0.0.11","data":{"app":"PHP"}}
{"reqId":"sfsrA8pYiv5usPBvGnGW","level":3,"time":"2023-12-21T11:20:05+01:00","remoteAddr":"...","user":"Keycloak-...","app":"index","method":"GET","url":"/apps/files/?dir=/Shares/something&fileid=63","message":"Call to a member function getPath() on null in file '/var/www/nextcloud/apps/files/lib/Controller/ViewController.php' line 240","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0","version":"28.0.0.11","exception":{"Exception":"Exception","Message":"Call to a member function getPath() on null in file '/var/www/nextcloud/apps/files/lib/Controller/ViewController.php' line 240","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Call to a member function getPath() on null","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"index","class":"OCA\\Files\\Controller\\ViewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/files/lib/Controller/ViewController.php","Line":240},"message":"Call to a member function getPath() on null in file '/var/www/nextcloud/apps/files/lib/Controller/ViewController.php' line 240","exception":{},"CustomMessage":"Call to a member function getPath() on null in file '/var/www/nextcloud/apps/files/lib/Controller/ViewController.php' line 240"}}

Additional info

Confirmed with Firefox 120.0.1 (Desktop) and Safari for iOS (unknown version). I think this started appearing after the 28 upgrade.

@levinuss levinuss added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Dec 21, 2023
joshtrichards added a commit that referenced this issue Dec 21, 2023
Fixes #42418 

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
@joshtrichards
Copy link
Member

Reproduced and also tested with NC26 and NC27. Definitely an NC28 specific regression. Feel free to try out the proposed fix in #42427 if so inclined.

@joshtrichards joshtrichards added 2. developing Work in progress feature: files regression and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Dec 21, 2023
@levinuss
Copy link
Author

Tested the fix on my instance with 28.0.1, works great. Thanks!
Looking forward to seeing this merged and in one of the next bugfix releases :)

backportbot-nextcloud bot pushed a commit that referenced this issue Dec 29, 2023
Fixes #42418 

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants