Skip to content

Commit 084fe50

Browse files
authored
Merge pull request #13098 from nextcloud/feat/document-wcf
feat(admin): document Windows compatible filenames
2 parents fef6ac5 + 71b828f commit 084fe50

File tree

5 files changed

+122
-0
lines changed

5 files changed

+122
-0
lines changed
186 KB
Loading

admin_manual/configuration_files/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ File sharing and management
2121
file_versioning
2222
trashbin_configuration
2323
file_conversion
24+
windows_compatible_filenames
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
.. _windows_compatible_filenames:
2+
3+
============================
4+
Windows compatible filenames
5+
============================
6+
7+
.. note::
8+
9+
This feature was introduced in Nextcloud 31.
10+
11+
By default Nextcloud supports all filenames which are valid on the underlying server.
12+
As Nextcloud runs only on POSIX compatible operating systems (Linux),
13+
this means that Nextcloud supports also filenames not valid on Microsoft Windows systems.
14+
15+
If your users use Windows and use the Nextcloud Desktop clients to synchronize their work
16+
to their computer they might encounter files created in the web interface, or on a Linux
17+
machine, which cannot be synchronized as the filename is not valid.
18+
19+
To solve this issue it is possible to enforce filenames only valid on Windows,
20+
this for example forbids characters like ``*`` from filenames
21+
or filenames like ``AUX.txt`` (on Windows ``AUX`` is a reserved name and cannot be used).
22+
23+
.. note::
24+
25+
Enabling this setting will not enforce case-insensitivity
26+
as modern Windows systems support case-sensitive filenames.
27+
28+
Enabling Windows compatible filenames
29+
-------------------------------------
30+
31+
This feature can be enabled either by using the web interface
32+
or by using an ``occ`` command.
33+
34+
.. note::
35+
36+
This feature works by setting a predefined set of system configuration settings.
37+
So after enabling this the ``config.php`` will be adjusted, which also means enabling
38+
this feature requires a writable configuration.
39+
40+
Using the web interface
41+
^^^^^^^^^^^^^^^^^^^^^^^
42+
43+
The setting is provided in the **Administration settings** under **Basic settings**.
44+
Within the **Files compatibility** section the Windows compatibility can be enabled.
45+
46+
.. figure:: images/files-windows-compatibility.png
47+
:alt: Enforce windows compatibility checkbox on the Administration - Basic settings - Files compatibility page.
48+
49+
Using the occ command
50+
^^^^^^^^^^^^^^^^^^^^^
51+
52+
.. note::
53+
54+
This command was introduced in Nextcloud 32.
55+
56+
To quickly enable or disable the feature an :ref:`occ command <occ_files_windows_filenames>` is provided.
57+
58+
Consequences
59+
------------
60+
61+
After enabling Windows compatible filenames users cannot create or modify files
62+
with invalid filenames. But they can still delete or rename those files (to valid names).
63+
64+
This works by setting a pre-defined set of configuration settings:
65+
66+
- ``forbidden_filename_basenames`` will be set to names reserved on Windows.
67+
- ``forbidden_filename_characters`` will be set to characters not valid for filenames on Windows.
68+
- ``forbidden_filename_extensions`` will be set to strings not allowed as trailing parts, like a trailing dot or spaces.
69+
70+
Sanitizing invalid filenames
71+
----------------------------
72+
73+
After enabling the feature the users have to manually adjust all invalid filenames
74+
to be able to keep working with them.
75+
As an alternative Nextcloud provides the :ref:`occ files:sanitize-filenames <occ_files_sanitize_filenames>` command to automatically rename all invalid files.

admin_manual/occ_command.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,36 @@ This command attempts to repair such entries by querying for entries where the p
974974
doesn't match the expected path based on it's parent path and filename and resets it's
975975
path to the expected one.
976976

977+
.. _occ_files_sanitize_filenames:
978+
979+
Sanitize filenames
980+
^^^^^^^^^^^^^^^^^^
981+
982+
This command allows to automatically rename files not matching the current file naming constraints,
983+
for example after enabling the :ref:`Windows compatible filenames <windows_compatible_filenames>`::
984+
985+
Usage:
986+
files:sanitize-filenames [options] [--] [<user_id>...]
987+
988+
Arguments:
989+
user_id Limit filename sanitizing to files given user(s) have access to
990+
991+
Options:
992+
--dry-run Do not actually rename any files but just check filenames.
993+
-c, --char-replacement=CHAR-REPLACEMENT Replacement for invalid character (by default space, underscore or dash is used)
994+
995+
When running this command without parameters it will scan all files of all users
996+
for filenames not comply with the current filename constraints and try to automatically
997+
rename those files.
998+
Invalid characters will be replaced by default with either a space, underscore, or dash
999+
depending on which characters are allowed.
1000+
If your constraints forbid all of them, then you have to provide an character replacement
1001+
yourself by specifying the ``--char-replacement`` option.
1002+
1003+
The ``--dry-run`` option allows to perform the sanitizing without the actual renaming,
1004+
this is useful for estimating the execution time and to get an overview on what renaming
1005+
actions will be performed.
1006+
9771007
Transfer
9781008
^^^^^^^^
9791009

@@ -1028,6 +1058,21 @@ See `user documentation <https://docs.nextcloud.com/server/latest/user_manual/en
10281058

10291059
.. TODO ON RELEASE: Update version number above on release
10301060
1061+
.. _occ_files_windows_filenames:
1062+
1063+
Toggle Windows compatibility
1064+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1065+
1066+
The command ``occ files:windows-compatible-filenames`` can be used to toggle
1067+
enforcing :ref:`Windows compatible filenames <windows_compatible_filenames>`::
1068+
1069+
Usage:
1070+
files:windows-compatible-filenames [options]
1071+
1072+
Options:
1073+
--enable enable enforcing windows compatible filenames
1074+
--disable disable enforcing windows compatible filenames
1075+
10311076
.. _occ_sharing_label:
10321077

10331078
Files Sharing

go.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
'admin-trusted-domains' => '/admin_manual/installation/installation_wizard.html#trusted-domains',
5353
'admin-update' => '/admin_manual/maintenance/update.html',
5454
'admin-warnings' => '/admin_manual/configuration_server/security_setup_warnings.html',
55+
'admin-windows-compatible-filenames' => '/admin_manual/configuration_files/windows_compatible_filenames.html',
5556
'admin-workflowengine' => '/admin_manual/file_workflows/index.html',
5657

5758
'developer-manual' => '/developer_manual',

0 commit comments

Comments
 (0)