Cannot open files and folders when names contain special characters (space etc.)

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 17.0.2.1
Operating system and version (eg, Ubuntu 17.04): Ubuntu 19.10
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.1): 7.3

Database: mariadb 10.3
Desktop sync clients: Windows and Ubuntu

The issue you are facing:
When I try to open folders containing special characters (such as space, “(”, etc.), I cannot. I cannot generate error messages. When I try to open the folder from the browser it just doesn’t open it. Also desktop sync returns, internal server error for folders and cannot sync files. Interestingly, I can download files containing spaces in their file names.

Update: I started to believe that the problem is related to database connection to PHP or PHP’s handling of UTF-8

More on the issue:
I migrated to my server from Raspberry Pi 3B+, running an Opensuse Leap 15.1 to a Raspberry Pi 4 4GB, running an Ubuntu 19.10. I set it up manually and quite easily. On the front end everything looks normal.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Migrate server to Ubuntu 19.10 on Raspberry pi
  2. Setup mariadb
  3. Try to open a folder containing space as character in it

mariadb conf file my.cnf

[client]
default-character-set = utf8mb4
port = 3306
socket = /run/mysqld/mysqld.sock

[mysqld_safe]
log_error=/var/log/mysql/mysql_error.log
nice = 0
socket = /run/mysqld/mysqld.sock

[mysqld]
basedir = /usr
bind-address = 127.0.0.1
port = 3306
pid-file = /run/mysqld/mysqld.pid
socket = /run/mysqld/mysqld.sock

binlog_format = mixed
bulk_insert_buffer_size = 4M
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
concurrent_insert = 2
connect_timeout = 5
datadir = /var/lib/mysql
default_storage_engine = InnoDB
default_authentication_plugin=mysql_native_password
expire_logs_days = 10
general_log_file = /var/log/mysql/mysql.log
general_log = 0
innodb_buffer_pool_size = 128M
innodb_buffer_pool_instances = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_max_dirty_pages_pct = 90
innodb_file_per_table = 1
innodb_open_files = 400
innodb_io_capacity = 4000
innodb_flush_method = O_DIRECT
key_buffer_size = 128M
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
log_bin = /var/log/mysql/mariadb-bin
log_bin_index = /var/log/mysql/mariadb-bin.index
log_error=/var/log/mysql/mysql_error.log
log_slow_verbosity = query_plan
log_warnings = 2
long_query_time = 1
max_allowed_packet = 64M
max_binlog_size = 100M
max_connections = 200
max_heap_table_size = 32M
myisam_recover_options = BACKUP
myisam_sort_buffer_size = 64M
query_cache_limit = 2M
query_cache_size = 32M
query_cache_type = 1
query_cache_min_res_unit = 2k
read_buffer_size = 2M
read_rnd_buffer_size = 1M
skip-external-locking
skip-name-resolve
slow_query_log_file = /var/log/mysql/mariadb-slow.log
slow-query-log = 1
sort_buffer_size = 4M
table_open_cache = 400
thread_cache_size = 128
tmp_table_size = 32M
tmpdir = /tmp
transaction_isolation = READ-COMMITTED
user = mysql
wait_timeout = 600
[mysqldump]
max_allowed_packet = 64M
quick
quote-names
[isamchk]
!includedir /etc/mysql/conf.d/
key_buffer = 8M

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' => 
  array (
    0 => '',
  ),
  'datadirectory' => '',
  'overwrite.cli.url' => '',
  'version' => '17.0.2.1',
  'dbtype' => 'mysql',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '3306',
  'dbtableprefix' => 'oc_',
  'dbuser' => '',
  'dbpassword' => '',
  'mysql.utf8mb4' => true,
  'default_language' => 'en',
  'default_locale' => 'en_US',
  'defaultapp' => 'files',
  'knowledgebase' => 'true',
  'allow_user_to_change_display_name' => true,
  'installed' => true,
  'maintenance' => false,
  'loglevel' => 2,
  'updater.release.channel' => 'stable',
  'theme' => '',
  'overwritehost' => '',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/',
  'htaccess.RewriteBase' => '/',
  'proxy' => '',
  'trusted_proxies' => 
  array (
    0 => '127.0.0.1',
  ),
  'login_form_autocomplete' => false,
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '127.0.0.1',
    'port' => 6379,
    'timeout' => 0,
  ),
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'app_install_overwrite' => 
  array (
    0 => 'calendar',
  ),
  'data-fingerprint' => '',
  'appcodechecker' => true,
);

I’ve found this in the Error log, but I’m not sure, I wasn’t able to replicate it.

[PHP] Error: Error while sending QUERY packet. PID=10120 at /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php#88

at 2020-01-17T04:53:00+00:00

It was my apache settings all along,

I’ve replaced ProxyPassMatch with FilesMatch and it worked.

Hi evo,

Could you please help me step by step with replacing ProxyPassMatch with FilesMatch. I cannot open file with special characters. Checking nextcloud, I noticed it was not uploaded the file, but the file name appears in the Files, as it was uploaded. I am on Nextcloud 20.04. Thank you in advance.

@jbalazsi, you have something like the following in a VirtualHost section for the Nextcloud server (paths may differ):

		ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/var/run/php/php7.3-fpm.sock|fcgi://localhost/var/www/nextcloud/

Replace it with:

		<FilesMatch \.php$>
			SetHandler "proxy:unix:/var/run/php/php7.3-fpm.sock|fcgi://localhost/"
		</FilesMatch>