ios icon indicating copy to clipboard operation
ios copied to clipboard

Error when creating folder with forward slash (`/`) in the folder name

Open smokris opened this issue 1 month ago • 2 comments

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. In the Nextcloud iOS app, select the Files tab
  2. Tap the ➕ button
  3. Tap "Create folder"
  4. Enter a folder name that has a slash in it (e.g. a/b)
  5. Tap "Save"

Expected behaviour

The app should either:

  1. Successfully create a folder with a slash in the folder name (by encoding the slash in the WebDAV request and in the storage backend), or
  2. Prevent creating a folder with characters that aren't allowed, and show a helpful message similar to https://github.com/nextcloud/ios/issues/2880#issuecomment-2607471593

Actual behaviour

The app repeatedly attempts to create the folder but fails and shows a red "Error: Parent node does not exist, code: 409" banner, and the Transfers view shows the folder with status "Waiting to create the folder".

Folder view Transfers view
Image Image

Logs

  • The MKCOL /remote.php/dav/files/…/a/b request fails with Sabre\DAV\Exception\Conflict: Parent node does not exist

Reasoning or why should it be changed/implemented?

As an experienced Unix user, I know that folder names may not contain forward slashes. But people without that specific domain knowledge should be able to use the Nextcloud iOS app, without running into cryptic error messages.

I favor Expected Behavior Option 1 above because, to someone who isn't an experienced Unix user, the prohibition on forward slashes seems arbitrary and unnecessary. Forward slashes can be useful in folder names, such as Results of A/B Test or Trip to US/Mexico border at Nogales.

Environment data

iOS version: iOS 26.1

Nextcloud iOS app version: 7.2.2.4

Server operating system: Debian 13

Web server: Apache HTTPD 2.4.65

Database: MariaDB 11.8.2

PHP version: 8.4.11

Nextcloud version: 32.0.2

smokris avatar Dec 02 '25 19:12 smokris

Hi @smokris

  1. Do you have WCF enabled? https://docs.nextcloud.com/server/stable/admin_manual/configuration_files/windows_compatible_filenames.html

  2. Could you please post your config.php, primarily these 3 fields:

forbidden_filename_basenames
forbidden_filename_characters
forbidden_filename_extensions
  1. Also, could you please post the iOS logs once your open the app? I would like to sees what the server capabilities return as forbidden characters. You can get the iOS log in More->Advanced.

There was recently a change to disable validation if WCF is disabled, so the issue here may be an outcome of this: https://github.com/nextcloud/NextcloudKit/pull/201

mpivchev avatar Dec 03 '25 10:12 mpivchev

Thanks for your response, @mpivchev.

  1. Do you have WCF enabled? https://docs.nextcloud.com/server/stable/admin_manual/configuration_files/windows_compatible_filenames.html

No, WCF is disabled on our instance.

  1. Could you please post your config.php

Here's the full config.php, with names/IPs/secrets redacted:

config.php


$CONFIG = array (
  'log_type' => 'syslog',
  'log_type_audit' => 'syslog',
  'loglevel' => 1,
  'datadirectory' => '/var/www/…/data',
  'updatechecker' => false,
  'check_for_working_htaccess' => true,
  'asset-pipeline.enabled' => false,
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'overwriteprotocol' => 'https',
  'overwritehost' => '…',
  'trusted_proxies' =>
  array (
    0 => '…',
  ),
  'overwrite.cli.url' => 'https://…/',
  'htaccess.RewriteBase' => '/',
  'allow_local_remote_servers' => true,
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/…/web/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/…/apps',
      'url' => '/apps-appstore',
      'writable' => true,
    ),
  ),
  'instanceid' => '…',
  'passwordsalt' => '…',
  'secret' => '…',
  'trusted_domains' =>
  array (
    0 => '…',
  ),
  'dbtype' => 'mysql',
  'version' => '32.0.2.2',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '…',
  'dbpassword' => '…',
  'installed' => true,
  'mail_from_address' => 'admin',
  'mail_smtpmode' => 'sendmail',
  'mail_sendmailmode' => 'pipe',
  'mail_domain' => '…',
  'mail_smtphost' => '…',
  'mail_smtpport' => '25',
  'mail_smtptimeout' => 30,
  'social_login_auto_redirect' => true,
  'default_phone_region' => 'US',
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'allow_user_to_change_display_name' => true,
  'default_language' => 'en',
  'force_language' => 'en',
  'default_locale' => 'en_US',
  'force_locale' => 'en_US',
  'remember_login_cookie_lifetime' => 2764800,
  'auth.webauthn.enabled' => false,
  'hide_login_form' => true,
  'skeletondirectory' => '',
  'templatedirectory' => '',
  'trashbin_retention_obligation' => '365, 365',
  'versions_retention_obligation' => 'auto',
  'appcodechecker' => true,
  'sharing.enable_share_accept' => false,
  'sharing.force_share_accept' => true,
  'sharing.allow_custom_share_folder' => false,
  'sharing.enable_share_mail' => false,
  'files_external_allow_create_new_local' => false,
  'upgrade.disable-web' => true,
  'profile.enabled' => true,
  'enable_file_metadata' => true,
  'preview_max_memory' => 1024,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\AVI',
    1 => 'OC\\Preview\\BMP',
    2 => 'OC\\Preview\\Font',
    3 => 'OC\\Preview\\GIF',
    4 => 'OC\\Preview\\HEIC',
    5 => 'OC\\Preview\\Illustrator',
    6 => 'OC\\Preview\\Image',
    7 => 'OC\\Preview\\JPEG',
    8 => 'OC\\Preview\\Krita',
    9 => 'OC\\Preview\\MarkDown',
    10 => 'OC\\Preview\\MKV',
    11 => 'OC\\Preview\\Movie',
    12 => 'OC\\Preview\\MP3',
    13 => 'OC\\Preview\\MP4',
    14 => 'OC\\Preview\\MSOffice2003',
    15 => 'OC\\Preview\\MSOffice2007',
    16 => 'OC\\Preview\\MSOfficeDoc',
    17 => 'OC\\Preview\\OpenDocument',
    18 => 'OC\\Preview\\PDF',
    19 => 'OC\\Preview\\Photoshop',
    20 => 'OC\\Preview\\Postscript',
    21 => 'OC\\Preview\\PNG',
    22 => 'OC\\Preview\\SVG',
    23 => 'OC\\Preview\\StarOffice',
    24 => 'OC\\Preview\\TGA',
    25 => 'OC\\Preview\\TIFF',
    26 => 'OC\\Preview\\TXT',
    27 => 'OC\\Preview\\WebP',
    28 => 'OC\\Preview\\XBitmap',
  ),
  'maintenance' => false,
  'app_install_overwrite' =>
  array (
    0 => 'groupfolders',
  ),
  'defaultapp' => 'files',
  'maintenance_window_start' => 6,
  'auth.bruteforce.protection.enabled' => false,
  'ratelimit.protection.enabled' => false,
);

primarily these 3 fields:

forbidden_filename_basenames
forbidden_filename_characters
forbidden_filename_extensions

We aren't overriding these values.

3. Also, could you please post the iOS logs once your open the app? I would like to sees what the server capabilities return as forbidden characters. You can get the iOS log in More->Advanced.

The server capabilities endpoint returns:

    <forbidden_filenames>
     <element>.htaccess</element>
    </forbidden_filenames>
    <forbidden_filename_basenames/>
    <forbidden_filename_characters>
     <element>\</element>
     <element>/</element>
    </forbidden_filename_characters>
    <forbidden_filename_extensions>
     <element>.filepart</element>
     <element>.part</element>
    </forbidden_filename_extensions>

There was recently a change to disable validation if WCF is disabled, so the issue here may be an outcome of this: nextcloud/NextcloudKit#201

Oh, thanks for pointing that out. I briefly tried turning on WCF, and now the iOS app correctly prevents creating folders with / in the name:

With WCF enabled
Image

However, it does still seem like a bug that the forbidden_filename_characters capability value is ignored when WCF is disabled, since one might want to forbid only a subset of the characters forbidden on Windows.

smokris avatar Dec 03 '25 14:12 smokris