The Drupal 7 version used to render the URL alias if it could, but I can't get the 8.x version to do it.

Using 'Protocol relative URL', and entering a path of "/node/2" the output is http://example/node/2
But I would expect it to be http://example.com/alias-of-node-2

Using Url::fromUserInput instead of Url::fromUri seems to achieve this so I'll add a patch.

Issue fork pathologic-2692641

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

rikki_iki created an issue. See original summary.

rikki_iki’s picture

Category: Bug report » Feature request
Status: Active » Needs review
StatusFileSize
new567 bytes

Status: Needs review » Needs work

The last submitted patch, 2: 2692641-pathologic-use-alias-1.patch, failed testing.

kristofferwiklund’s picture

Status: Needs work » Reviewed & tested by the community

Works great.

acbramley’s picture

I was having the same issue, once I applied the patch from #2418369: Internal URL handling (language prefixes, base://, ...) it fixed it for me.

EDIT: https://www.drupal.org/files/issues/2418369-7.patch this one to be clear.

jhodgdon’s picture

Status: Reviewed & tested by the community » Needs work

Agreed. I think that the patch referenced in #5 here is preferable to the patch in this issue, so I'm setting this issue to Needs Work. Perhaps it should be marked as a duplicate?

nplowman’s picture

StatusFileSize
new545 bytes

I'm attaching an updated version of the patch which should apply cleanly with the latest Dev version.

derhasi’s picture

derhasi’s picture

This should be fixed with the latest patch in #2418369: Internal URL handling (language prefixes, base://, ...). Can you have a try on that?

@nplowman I guess base_path() will not catch all use cases, like files beeing detected by pathologic, as mentioned by @jhodgdon in that issue.

Mike Dodd’s picture

Latest patch works great for me, thank you

steveoriol’s picture

StatusFileSize
new727 bytes

I created a patch that works better for me on D8.5.1, if it helps ...

sittard’s picture

Any chance we could get this patch rolled out to the next release? Thanks.

steveoriol’s picture

The patch #11 should still works for D8.6.4 and pathologic 8.x-1.0-alpha1

fox mulder’s picture

#11 solves the problem

moshe weitzman’s picture

Status: Needs work » Needs review
StatusFileSize
new811 bytes

I think this issue has a more minimalist approach than #2418369: Internal URL handling (language prefixes, base://, ...) and therefore should stay open. I implore the maintainers to do something on this issue. Attached is a variant on this patch, but we let Url do the alias lookup instead of doing it ourselves. Its just 2 lines.

nitrospectide’s picture

I just applied Moshe's patch, and it works beautifully. I'm all for elegant, simple approaches.

Can #15 be committed and released?

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

RTBC based on last review

The last submitted patch, 7: 2692641-pathologic-use-alias-7.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

ab2211’s picture

#11 doesn't help me. Drupal 8.9.8 and 8.x-1.0-alpha2.

federiko_’s picture

I can confirm that patch #15 works perfectly.
Aliases are now showing into my blocks bodies.
> Drupal 9.1.4 / Pathologic 8.x-1.0-alpha2

phily’s picture

patch #15 works for me using Drupal 8.9.13 and Pathologic 8.x-1.0-alpha2
Thanks

ab2211’s picture

Hm, patch #15 did not help.

andrewsuth’s picture

Patch #15 works for me.

  • dww committed 2fa52b1 on 8.x-1.x authored by moshe weitzman
    Issue #2692641 by rikki_iki, moshe weitzman, steveoriol, nplowman, dww:...
  • dww committed db370f9 on 8.x-1.x
    Issue #2692641 by dww: Cleanup test assertions for exception handling...
dww’s picture

Status: Reviewed & tested by the community » Fixed

Sorry folks, I kinda forgot I agreed to co-maintain this. I haven't looked at the issue queue in ages.

Anyway, agreed this is a small, simple fix. #2418369: Internal URL handling (language prefixes, base://, ...) definitely needs to also happen, but that might take a bit longer. I had to fix the tests a bit after this went in for them to pass locally, but otherwise, this looked good. Pushed to 8.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

dww’s picture

Status: Closed (fixed) » Needs work

Bummer. It looks like this change broke multilingual sites and we're likely to revert it at #3270030: 8.x-1.0-alpha3 breaks images in multi-language sites.. Had this issue had any tests with it, we might be able to find a solution that keeps both features working. But for now, we're going to have to go with fixing bugs at the expense of feature "regressions". It's all still "alpha" at this point. 😅

If someone wants to provide tests that demonstrate the scenario this change was supposed to help, that'd be fantastic. Otherwise, I'm afraid this will have only happened for alpha3, and this feature will be going away in future releases.

Alas,
-Derek

solideogloria made their first commit to this issue’s fork.

solideogloria’s picture

Version: 8.x-1.x-dev » 2.0.x-dev

Moving to target 2.x

solideogloria’s picture

I created the fork from the wrong version of the module, so I can't figure out how to get a MR for 2.0.x. Oh well. Here's a patch, since the prior patches don't apply to 2.0.x.

solideogloria’s picture

The patch works wonderfully for 2.0.x if you don't have translations.

alexander tallqvist’s picture

StatusFileSize
new964 bytes

Re-rolled patch for 2.0.0.

solideogloria’s picture

Title: Convert href to the aliased url if possible » Convert href to the aliased URL if possible

It's time to use merge requests instead of patches.

solideogloria changed the visibility of the branch 2692641-convert-href-to to hidden.

solideogloria’s picture

solideogloria’s picture

Rebasing MR

solideogloria changed the visibility of the branch 2692641-2.0.x to hidden.

solideogloria’s picture

The prior branch was having trouble rebasing. Created a new branch and updated the fork before making changes.

solideogloria’s picture

Issue tags: +Needs tests