ezyang / ezyang/htmlpurifier

Enabled HTML.Nofollow and set URI.Host but nofollow is add to internal links

Open
#208 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.4k
Forks
361
Avg merge
3d 41m
Merged PRs (30d)
2

Description

I've found a relative question but it doesn't solve my problem.

http://htmlpurifier.org/phorum/read.php?2,5611

In my html page i have some links like:

<a href='http:\/\/mydomain.com\/' target=\"_blank\">Link<\/a>
<a href='https:\/\/mydomain.com\/' target=\"_blank\">Link<\/a>
<a href='http:\/\/sub.mydomain.com\/' target=\"_blank\">Link<\/a>
<a href='https:\/\/sub.mydomain.com\/' target=\"_blank\">Link<\/a>
<a href='http:\/\/www.mydomain.com\/' target=\"_blank\">Link<\/a>
<a href='https:\/\/www.mydomain.com\/' target=\"_blank\">Link<\/a>

I set URI.Host like mydomain.com
$config->set('URI.Host', 'mydomain.com');

The results of HTML.Nofollow that i set
$config->set('HTML.Nofollow', true);
is:

<a href="http://mydomain.com">Link<\/a>
<a href="https://mydomain.com">Link<\/a>
<a href="http://sub.mydomain.com"  rel="nofollow">Link<\/a>
<a href="https://sub.mydomain.com"  rel="nofollow">Link<\/a>
<a href="http://www.mydomain.com"  rel="nofollow">Link<\/a>
<a href="https://www.mydomain.com"  rel="nofollow">Link<\/a>

Why are the other subdomain nofollow?

I try also whithout http and https. It works but i need them!
example

<a href='mydomain.com\/' target=\"_blank\">Link<\/a>
<a href='mydomain.com\/' target=\"_blank\">Link<\/a>
<a href='sub.mydomain.com\/' target=\"_blank\">Link<\/a>
<a href='sub.mydomain.com\/' target=\"_blank\">Link<\/a>
<a href='www.mydomain.com\/' target=\"_blank\">Link<\/a>
<a href='www.mydomain.com\/' target=\"_blank\">Link<\/a>
<a href="http://mydomain.com">Link<\/a>
<a href="https://mydomain.com">Link<\/a>
<a href="http://sub.mydomain.com">Link<\/a>
<a href="https://sub.mydomain.com" >Link<\/a>
<a href="http://www.mydomain.com">Link<\/a>
<a href="https://www.mydomain.com">Link<\/a>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the examples with URI.Host set to mydomain.com and HTML.Nofollow enabled, comparing bare hostnames with http and https URLs. Determine whether subdomains are intended to be treated as internal or external, then clarify or correct the behavior and verify it with a regression test if the project provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
security, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.