Linkchecker incorrectly reports permanent redirects on internal linkit links

Created on 7 June 2023, over 1 year ago
Updated 4 September 2024, 4 months ago

Problem/Motivation

When running linkchecker on internal links we found that internal linkit links were incorrectly being reported as moved permanently because linkchecker is checking the node body directly without invoking any filters.

Ex: Error Moved Permanently for link: http://dev.ddev.site/node/431

If the filters were applied prior to linkchecking then the proper url alias would be checked and no error reported.

Steps to reproduce

1. Enabled linkit on node body
2. Enable linkit
3. Create a link using linkit in a test node
4. Run linkchecker

Proposed resolution

On text, text_long and text_with_summary fields invoke the field item view method during link extraction.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

2.1

Component

Code

Created by

🇨🇦Canada joel_osc

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

Merge Requests

Comments & Activities

  • Issue created by @joel_osc
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Patch Failed to Apply
  • 🇨🇦Canada joel_osc

    Here is a patch that will invoke the filters prior to linkchecking.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Build Successful
  • 🇨🇦Canada joel_osc

    Not sure what happened to the first patch, here is a properly formatted one.

  • 🇳🇴Norway eiriksm Norway

    Thanks 🙏

    For starters, do you mind fixing the coding standards in your patch? 🤓

  • Status changed to Needs work over 1 year ago
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Build Successful
  • 🇨🇦Canada joel_osc

    Fixed long comment line... thx!

  • 🇩🇪Germany Anybody Porta Westfalica

    I can sadly confirm this issue. All URLs made by linkit dynamically are unaliased and therefore cause 301 redirect detection.

    As linkit is widely used and also the ckeditor integration, I'd say this is a bug.

  • 🇩🇪Germany Anybody Porta Westfalica
  • Merge request !83Added patch #6 → (Open) created by Anybody
  • 🇩🇪Germany Anybody Porta Westfalica

    I created a MR against 2.1.x from the patch in #6 now to give it a try.
    @eiriksm what would you say regarding the logics? I'm not experienced enough in this module yet to decide on that.

    I'll report if it works at least.

  • Pipeline finished with Failed
    4 months ago
    Total: 201s
    #273604
  • Status changed to Needs work 4 months ago
  • 🇩🇪Germany Anybody Porta Westfalica
     ------ ---------------------------------------------------------------------- 
      Line   src/LinkExtractorService.php                                          
     ------ ---------------------------------------------------------------------- 
      168    \Drupal calls should be avoided in classes, use dependency injection  
             instead                                                               
     ------ ----------------------------------------------------------------------
    
  • Pipeline finished with Failed
    4 months ago
    Total: 201s
    #273655
  • Pipeline finished with Canceled
    4 months ago
    Total: 31s
    #273663
  • Pipeline finished with Failed
    4 months ago
    Total: 198s
    #273664
  • 🇩🇪Germany Anybody Porta Westfalica

    Okay I can tell that this at least still fixes the issue with linkit. Link checking now works as expected again and has correct results.

    Still some things left to be done:

    • Use dependency injection
    • Check why tests fail, eventually fix implementation
  • 🇩🇪Germany Anybody Porta Westfalica

    Static patch for the time being.

  • Pipeline finished with Failed
    4 months ago
    Total: 201s
    #273670
Production build 0.71.5 2024