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

url: improve descriptiveness of identifier #12579

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,14 +765,14 @@ Url.prototype.resolveObject = function resolveObject(relative) {
var removeAllDots = mustEndAbs;
var srcPath = result.pathname && result.pathname.split('/') || [];
var relPath = relative.pathname && relative.pathname.split('/') || [];
var psychotic = result.protocol && !slashedProtocol[result.protocol];
var noLeadingSlashes = result.protocol && !slashedProtocol[result.protocol];

// if the url is a non-slashed url, then relative
// links like ../.. should be able
// to crawl up to the hostname, as well. This is strange.
// result.protocol has already been set by now.
// Later on, put the first path part into the host field.
if (psychotic) {
if (noLeadingSlashes) {
result.hostname = '';
result.port = null;
if (result.host) {
Expand Down Expand Up @@ -820,7 +820,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
// just pull out the search.
// like href='?foo'.
// Put this after the other two cases because it simplifies the booleans
if (psychotic) {
if (noLeadingSlashes) {
result.hostname = result.host = srcPath.shift();
//occasionally the auth can get stuck only in host
//this especially happens in cases like
Expand Down Expand Up @@ -901,7 +901,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
(srcPath[0] && srcPath[0].charAt(0) === '/');

// put the host back
if (psychotic) {
if (noLeadingSlashes) {
result.hostname = result.host = isAbsolute ? '' :
srcPath.length ? srcPath.shift() : '';
//occasionally the auth can get stuck only in host
Expand Down