Problem/Motivation

This module currently only indexes links that use the relative path. The link will not be indexed when the absolute path to the own website is used. Editors/content creators may choose to add absolute paths as valid links and expect them to be indexed as backlinks. Therefore this feature may reduce confusion by preventing missing links.

Steps to reproduce

Add an absolute path to your own content and try to have it indexed by the backlinks module.

Proposed resolution

We refine the validation process of the html string in BacklinksManager.php

For us it would not be necessary to make this feature configurable. However, if others would be helped by it, I could add an option for this feature to the config form. I will not add this configuration option until further notice.

Remaining tasks

Possible configuration option (see above: proposed resolution section).

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

m.gaebler created an issue. See original summary.

m.gaebler’s picture

Status: Active » Needs review

matej.lehotsky made their first commit to this issue’s fork.

matej.lehotsky’s picture

matej.lehotsky’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks

matej.lehotsky’s picture

Status: Reviewed & tested by the community » Fixed
matej.lehotsky’s picture

Version: 1.0.1 » 1.1.1
Status: Fixed » Closed (fixed)
m.gaebler’s picture

My colleague reviewed the code and mentioned that getCurrentRequest() may return NULL. If this happens, the getHost() method will not work, and our (new) isInternalAbsoluteLink() method will fail.

For reference, see: Symfony\Component\HttpFoundation\RequestStack::getCurrentRequest()

We could add an extra check around this method call:

$request = $this->requestStack->getCurrentRequest();
if (!$request) {
  return FALSE;
}
$current_host = $request->getHost();

If you agree with this change, how do you suggest we proceed? Can we re-open the MR? Or should it be a new issue/MR?