Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow adding and checking vhosts with path #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/HasRobots.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public function getLastRobotScansAttribute()

public function getRobotsUrlAttribute()
{
return $this->url . '/robots.txt';
$parts = parse_url($this->url);
return sprintf('%s://%s/robots.txt', $parts['scheme'], $parts['host']);
}

}
4 changes: 1 addition & 3 deletions app/Website.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ public function getShowLinkAttribute()
*/
public function setUrlAttribute($value)
{
$parts = parse_url($value);

$this->attributes['url'] = sprintf('%s://%s', $parts['scheme'], $parts['host']);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi, I'm not sure about this one - The rest of the application "relies" on the data being normalised before it gets to the database.

Removing this normalisation means that other areas would receive unexpected input e.g.

If the user enters https://google.com/ then certain areas might generate inaccurate urls e.g. https://google.com//favicon.ico

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see your point.
Would you prefer to add a normalized_hostname property (just like the dns_hostname) that can be used in cases where a normalized hostname is required, and using the original user-input for open-graph/uptime/crawler checks?

But when testing i didn´t encounter any issues with wrongly generated urls. Only the robots check had issues, but that is taken care of in this change.

$this->attributes['url'] = $value;
}
}