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]: unable to open/view/download files with spaces (WITH Q&D FIX!) #37852

Closed
6 of 9 tasks
mrAceT opened this issue Apr 20, 2023 · 3 comments
Closed
6 of 9 tasks

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

mrAceT opened this issue Apr 20, 2023 · 3 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback bug

Comments

@mrAceT
Copy link

mrAceT commented Apr 20, 2023

⚠️ 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?)!

@come-nc
Copy link
Contributor

come-nc commented Apr 24, 2023

Which exact PHP version?
Sounds like php/php-src#10869

@come-nc
Copy link
Contributor

come-nc commented Apr 24, 2023

(Which is fixed in 8.1.18: https://github.com/php/php-src/blob/PHP-8.1/NEWS#L38L63 )

@mrAceT
Copy link
Author

mrAceT commented Apr 24, 2023

@come-nc: You are absolutely correct!

It was running at PHP8.1.16, I have upgraded PHP to 8.1.18 and the problem is also gone in the "unpatched" test Nextcloud!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback bug
Projects
None yet
Development

No branches or pull requests

3 participants