Skip to content
This repository has been archived by the owner on Aug 8, 2022. It is now read-only.

Bugfix: if config.absRefPrefix is used, fullUrl returns wrong absolute uri #353

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Teddytrombone
Copy link

@Teddytrombone Teddytrombone commented Feb 22, 2017

Fixes #354

// specified domain
$url = 'http://' . $domain . '/' . $url;
if(!preg_match('/^https?:\/\//i', $domain)) {
$domain = 'http://' . $domain;
Copy link
Member

@thomaszbz thomaszbz Feb 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about https support? Regex expression allows https, but $domain = forgets that.

Btw., is this an old (separate) issue, which always existed (eventually add a new/separate github issue?)?

Copy link
Author

@Teddytrombone Teddytrombone Feb 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we have to make some assumptions. If the passed domain has a scheme, everything is ok, so no scheme is prepended. If there is no scheme - so the regex doesn't match - I think we can't reliably guess the correct scheme at this code line (because in fact, the domain could be any domain, which could have https support or not), so the best is to stick with http ;-)

Instead of the regex a parse_url call could be used to check, if there is a scheme. Or we could make the regex more general ('/[a-z]+:\/\//i').

Copy link
Author

@Teddytrombone Teddytrombone Feb 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user of this method really wants to specify the scheme, it could be done with the $domain parameter. Maybe it's more clear to rename the parameter from $domain to something like $baseUrlOverride

@mblaschke mblaschke closed this Jun 11, 2017
@thomaszbz thomaszbz changed the base branch from develop to master June 13, 2017 14:39
@thomaszbz
Copy link
Member

thomaszbz commented Jun 13, 2017

PR accidently got closed when dropping the old develop branch.

Still needs to be reviewed. Reopened it again.

@thomaszbz thomaszbz reopened this Jun 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants