File ID (fid) not migrated, differs from source

Created on 31 July 2019, over 5 years ago
Updated 20 January 2023, almost 2 years ago

Hi,

Using this module to migrate Drupal 7 files into a Drupal 8 site, copying files from a remote HTTP source using the following piece of code:

source:
  plugin: d7_file
  scheme: public
  constants:
    source_base_path: sites/default/
    source_base_href: 'http://www.domain.org'
[...]
process:
  fid:
    -
      plugin: get
      source: fid
[...]
  source_remote_url:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/source_base_href
        - filepath
  file:
    -
      plugin: file_import
      source: '@source_remote_url'

This works quite well, except it does not take the old D7 fid into account, and generated a new fid based on the file_managed fid auto_increment. This will then result into other migrations not being able to lookup the file based on the old fid, resulting in missing files.

I will attach a patch that corrects this behaviour. This patch is WIP, since it's somewhat hard-coded, but at least illustrates the issue, and fixes it for now.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇳🇱Netherlands Martijn Houtman

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇸🇮Slovenia g1smo

    I can confirm this bug is still present.
    The patch in #3 helped.

    In our case, the file was not copied from a remote source.

Production build 0.71.5 2024