Skip to content

[Bug]: unable to open/view/download files with spaces (WITH Q&D FIX!) #37852

@mrAceT

Description

@mrAceT

⚠️ 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

I have a file added to my nextcloud wit a space in the file name, it does show a preview of the file, but when the file is clicked, or attempted to download I get an error "app not installed" (without telling me which app!?

Steps to reproduce

  1. upload file (an image, or a document, does not matter)
  2. open it via the web interface
  3. error..

Expected behavior

opening/downloading the file!

Installation method

Community Web installer on a VPS or web space

Nextcloud Server version

25

Operating system

RHEL/CentOS

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MariaDB

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

Updated from a minor version (ex. 22.2.3 to 22.2.4)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

not the problem, I have figured out the cause, read on.. ;)

List of activated Apps

not the problem, I have figured out the cause, read on.. ;)

Nextcloud Signing status

not the problem, I have figured out the cause, read on.. ;)

Nextcloud Logs

not the problem, I have figured out the cause, read on.. ;)

Additional info

I started digging in the system, and found the cause!

In /lib/private/AppFramework/Http/ there is a file called Request.php with in function getRawPathInfo the line:

$scriptName = $this->server['SCRIPT_NAME'];
here $scriptName gets the content of the server variable 'SCRIPT_NAME'. The odd thing is that when I click on an image without a space the images is retrieved via:

https://[domain]/remote.php/dav/files/[user]/file_without_space.jpg
then the $scriptName gets the content: 'remote.php'

when a file WITH space is clicked in the web-interface:

https://[domain]/remote.php/dav/files/[user]/file%20with%20space.jpg

This is not surprising, but the $scriptName now has the content: '/remote.php/dav/files/[user]/file with space.jpg'

This is exactly the same as $_SERVER['SCRIPT_NAME'], so I am guessing this might very well be an bug in Almalinux? (version 8.7)

But this makes a mess of the rest of the function, '\Sabre\Uri\split' splits on the space resulting in not detecting that it is a DAV call, resulting in the strange error..

I "Q&D" fixed by adding this below/at the mentioned line:

		$scriptName = $this->server['SCRIPT_NAME'];
 		if (strpos($scriptName,'.php/') > 0) {
		      $scriptName = substr($scriptName,0,strpos($scriptName,'.php/')+4);
		}

It might not be the perfect solution, but it does do the trick! I can now view, open and download files with spaces (again?)!

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap25-feedbackbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions