aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/integration/dav_features/dav-v2.feature4
-rw-r--r--core/Migrations/Version13000Date20170718121200.php3
-rw-r--r--core/Migrations/Version32000Date20250422135900.php34
-rw-r--r--lib/private/Files/FilenameValidator.php6
4 files changed, 41 insertions, 6 deletions
diff --git a/build/integration/dav_features/dav-v2.feature b/build/integration/dav_features/dav-v2.feature
index 9eae9a1b5fd..88b9d7c6460 100644
--- a/build/integration/dav_features/dav-v2.feature
+++ b/build/integration/dav_features/dav-v2.feature
@@ -114,7 +114,7 @@ Feature: dav-v2
And user "user0" exists
And user "user0" has a quota of "10 MB"
And As an "user0"
- When User "user0" uploads file "data/textfile.txt" to "/long-filename-with-250-characters-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.txt"
+ When User "user0" uploads file "data/textfile.txt" to "/long-filename-with-255-characters-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.txt"
Then the HTTP status code should be "201"
Scenario: Uploading a file with a too long filename
@@ -123,7 +123,7 @@ Feature: dav-v2
And user "user0" exists
And user "user0" has a quota of "10 MB"
And As an "user0"
- When User "user0" uploads file "data/textfile.txt" to "/long-filename-with-251-characters-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.txt"
+ When User "user0" uploads file "data/textfile.txt" to "/long-filename-with-256-characters-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.txt"
Then the HTTP status code should be "400"
Scenario: Create a search query on image
diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php
index 1adbf2f0ea2..e47dd72f7cd 100644
--- a/core/Migrations/Version13000Date20170718121200.php
+++ b/core/Migrations/Version13000Date20170718121200.php
@@ -178,7 +178,8 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
]);
$table->addColumn('name', 'string', [
'notnull' => false,
- 'length' => 250,
+ // changed from 250 to 255 in Nextcloud 32 to align with operating systems (Version32000Date20250422135900)
+ 'length' => 255,
]);
$table->addColumn('mimetype', Types::BIGINT, [
'notnull' => true,
diff --git a/core/Migrations/Version32000Date20250422135900.php b/core/Migrations/Version32000Date20250422135900.php
new file mode 100644
index 00000000000..f0c511c8144
--- /dev/null
+++ b/core/Migrations/Version32000Date20250422135900.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OC\Core\Migrations;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\Attributes\ModifyColumn;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+/**
+ * Adjust name length to support 255 characters to align with operating systems.
+ *
+ * See also Version13000Date20170718121200
+ */
+#[ModifyColumn(table: 'filecache', name: 'name', description: 'adjust length to maximal supported 255 characters')]
+class Version32000Date20250422135900 extends SimpleMigrationStep {
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ $table = $schema->getTable('filecache');
+ $column = $table->getColumn('name');
+ if ($column->getLength() < 255) {
+ $column->setLength(255);
+ }
+
+ return $schema;
+ }
+}
diff --git a/lib/private/Files/FilenameValidator.php b/lib/private/Files/FilenameValidator.php
index b1979789ec8..e07c07a9208 100644
--- a/lib/private/Files/FilenameValidator.php
+++ b/lib/private/Files/FilenameValidator.php
@@ -180,9 +180,9 @@ class FilenameValidator implements IFilenameValidator {
throw new InvalidDirectoryException($this->l10n->t('Dot files are not allowed'));
}
- // 255 characters is the limit on common file systems (ext/xfs)
- // oc_filecache has a 250 char length limit for the filename
- if (isset($filename[250])) {
+ // 255 characters is the limit on common file systems (ext/xfs) and in general on Linux.
+ // this is also the limit of oc_filecache for the filename
+ if (isset($filename[255])) {
throw new FileNameTooLongException();
}