summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--core/modules/file/migrations/d7_file.yml9
-rw-r--r--core/modules/file/migrations/d7_file_private.yml9
-rw-r--r--core/modules/file/tests/modules/file_test_get_ids/migrations/d7_file_used.yml9
-rw-r--r--core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php4
-rw-r--r--core/modules/file/tests/src/Kernel/Migrate/d7/MigratePrivateFileTest.php4
5 files changed, 32 insertions, 3 deletions
diff --git a/core/modules/file/migrations/d7_file.yml b/core/modules/file/migrations/d7_file.yml
index 3ead3e5ed436..4ad4e941e795 100644
--- a/core/modules/file/migrations/d7_file.yml
+++ b/core/modules/file/migrations/d7_file.yml
@@ -19,7 +19,14 @@ process:
# If you are using this file to build a custom migration consider removing
# the fid field to allow incremental migrations.
fid: fid
- filename: filename
+ # File entity module uses file_managed.filename as the entity title, while
+ # Drupal 8 expects this to be an actual file name. Therefore, extract the
+ # filename from the uri field. Otherwise, the file will migrate but form
+ # validation won't pass when editing it.
+ filename:
+ plugin: callback
+ callable: basename
+ source: uri
source_full_path:
-
plugin: concat
diff --git a/core/modules/file/migrations/d7_file_private.yml b/core/modules/file/migrations/d7_file_private.yml
index e0e1705d7544..0ac986c20f80 100644
--- a/core/modules/file/migrations/d7_file_private.yml
+++ b/core/modules/file/migrations/d7_file_private.yml
@@ -17,7 +17,14 @@ process:
# If you are using this file to build a custom migration consider removing
# the fid field to allow incremental migrations.
fid: fid
- filename: filename
+ # File entity module uses file_managed.filename as the entity title, while
+ # Drupal 8 expects this to be an actual file name. Therefore, extract the
+ # filename from the uri field. Otherwise, the file will migrate but form
+ # validation won't pass when editing it.
+ filename:
+ plugin: callback
+ callable: basename
+ source: uri
source_full_path:
-
plugin: concat
diff --git a/core/modules/file/tests/modules/file_test_get_ids/migrations/d7_file_used.yml b/core/modules/file/tests/modules/file_test_get_ids/migrations/d7_file_used.yml
index 93d0300166f8..9692bcd1f21a 100644
--- a/core/modules/file/tests/modules/file_test_get_ids/migrations/d7_file_used.yml
+++ b/core/modules/file/tests/modules/file_test_get_ids/migrations/d7_file_used.yml
@@ -9,7 +9,14 @@ source:
source_base_path: ''
process:
fid: fid
- filename: filename
+ # File entity module uses file_managed.filename as the entity title, while
+ # Drupal 8 expects this to be an actual file name. Therefore, extract the
+ # filename from the uri field. Otherwise, the file will migrate but form
+ # validation won't pass when editing it.
+ filename:
+ plugin: callback
+ callable: basename
+ source: uri
source_full_path:
-
plugin: concat
diff --git a/core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php b/core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php
index fcfe5adcfe6f..f427e7a0ac6f 100644
--- a/core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php
+++ b/core/modules/file/tests/src/Kernel/Migrate/d7/MigrateFileTest.php
@@ -24,6 +24,10 @@ class MigrateFileTest extends MigrateDrupal7TestBase {
*/
protected function setUp(): void {
parent::setUp();
+ $this->sourceDatabase->update('file_managed')
+ ->fields(['filename' => 'this can have spaces in it'])
+ ->condition('fid', 1)
+ ->execute();
$this->fileMigrationSetup();
}
diff --git a/core/modules/file/tests/src/Kernel/Migrate/d7/MigratePrivateFileTest.php b/core/modules/file/tests/src/Kernel/Migrate/d7/MigratePrivateFileTest.php
index f9ecfc7fb6ed..8fc020d29914 100644
--- a/core/modules/file/tests/src/Kernel/Migrate/d7/MigratePrivateFileTest.php
+++ b/core/modules/file/tests/src/Kernel/Migrate/d7/MigratePrivateFileTest.php
@@ -24,6 +24,10 @@ class MigratePrivateFileTest extends MigrateDrupal7TestBase {
*/
protected function setUp(): void {
parent::setUp();
+ $this->sourceDatabase->update('file_managed')
+ ->fields(['filename' => 'this can have spaces in it'])
+ ->condition('fid', 3)
+ ->execute();
$this->setSetting('file_private_path', $this->container->getParameter('site.path') . '/private');
$this->fileMigrationSetup();
}