Customized values lost on subsequent imports

Created on 20 December 2023, about 1 year ago
Updated 21 May 2024, 7 months ago

Problem/Motivation

If you import the same rows more than once with identical values, the values for those tags will be lost and will be reverted to the default global values. This is happening as a result of the code added in ✨ Don't save value if it would be equal to the rendered output Fixed .

Steps to reproduce

  • Create a CSV test file to update the title and description tags of a node.
  • Upload the file to the import form. At this point, you should have modified the title and description tags on that node with the customized versions from the CSV file.
  • Upload the same file again to the import form.

Now the customizations are lost, and you're back to the default tokens.

Proposed resolution

We should only skip the tags if they haven't been customized. We can discover that by looking at $entity->METATAG_FIELD_NAME.

Remaining tasks

Patching coming.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States zengenuity

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

Comments & Activities

  • Issue created by @zengenuity
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    10 pass
  • πŸ‡ΊπŸ‡ΈUnited States zengenuity

    Patch attached.

  • Status changed to Needs work 7 months ago
  • πŸ‡¬πŸ‡§United Kingdom joachim

    I'm afraid I don't follow this at all.

    I can *just about* understand the problem at other issue. How was that fixed incorrectly?

    +++ b/src/MetatagImport.php
    @@ -205,6 +205,18 @@ class MetatagImport {
    +      if (!empty($raw_value[0]['value'])) {
    +        if (function_exists('metatag_data_decode')) {
    +          $raw_tags = metatag_data_decode($raw_value[0]['value']);
    +        }
    +        else {
    +          $raw_tags = unserialize($raw_value[0]['value']);
    

    This could use comments to explain what's going on.

Production build 0.71.5 2024