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

IIS + can`t download/open files with special characters #6267

Closed
ForumSchlampe opened this issue Dec 9, 2013 · 7 comments
Closed

IIS + can`t download/open files with special characters #6267

ForumSchlampe opened this issue Dec 9, 2013 · 7 comments
Labels

Comments

@ForumSchlampe
Copy link

Expected behaviour
Single click on a file with special characters in the webUI should start the download
-> Works for files without any special character (like german umlauts)

Actual behaviour
Single click on a file with or without Special characters should open/start the download.
Downloadbutton works for such files but this isnt handy...and users got confused cause some files work this way and others not.

Steps to reproduce

  1. Open web ui and login
  2. Upload a file with the Name like "täst.pdf"
  3. Click on the filename after upload

Server configuration
IIS 7.5
PHP 5.5
Windows Server 2008 R2
MySQL
Internal Storage (NTFS)

Client configuration
OS: Windows 7, OSX
Browser: IE10/11, Firefox, Opera, Chrome, Safari

Operating system:
Windows 7
OSX

@karlitschek
Copy link
Contributor

@ringmaster Can you reproduce that?

@ringmaster
Copy link
Contributor

Yes, I can reproduce this on OC6. Looking into it now.

@ringmaster
Copy link
Contributor

This issue has to do with how IIS handles url-encoded URLs before passing them on to FastCGI apps. Normally, the URLs (the PATH_INFO part) are decoded before they're forwarded to FastCGI (including PHP). Because of this, UTF-8 URLs that include the downloadable file within the path (not the querystring) are decoded and passed on to PHP. But IIS decodes URLs only to ASCII by default. This results in incorrect path URLs being forwarded to the PHP CGI, which is why ownCloud is unable to find files with UTF-8 characters for download.

By contrast, IIS does not decode the querystring of URLs before passing them to the FastCGI apps. This is why clicking on the download link in the file list (which generates a different URL that includes the filename as part of the querystring) is successful.

To fix this issue, IIS must be convinced to decode UTF-8 URLs as UTF-8, and not ASCII, before passing them on to the PHP CGI application.

I was able to successfully accomplish this by changing a registry setting on the IIS server, which sets the encoding for the REQUEST_URI and PATH_INFO server variables to UTF-8. Follow these steps:

  1. Open a console window with administrative privileges.
  2. Run this command to adjust the registry settings:
    reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\w3svc\Parameters /v FastCGIUtf8ServerVariables /t REG_MULTI_SZ /d REQUEST_URI\0PATH_INFO
  3. Restart IIS.

After completing these steps, UTF-8 URLs should be forwarded correctly to PHP, and the encoded filenames should properly download.

@ForumSchlampe please try this fix and report your results. This could be very helpful to others who have a similar issue.

@ForumSchlampe
Copy link
Author

@ringmaster
works for me, thanks

Maybe there should be a hint in the install documentation to enable this by default for Windows/IIS installations....think this should be highly recomended.

@karlitschek
Copy link
Contributor

@ringmaster awesome. Do you think we can add this to the documentation?

@AnthonyAoun1
Copy link

I have a PHP script that uploads docs manually to moodle,
This script doesn't work with documents containing any special character (like Arabic) in the file name
I am using Windows Server 2012 R2 Standard and I am running the script from cmd

@lock
Copy link

lock bot commented Aug 7, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants