Skip to content

Commit 3fd009e

Browse files
Trottgibfahn
authored andcommitted
url: improve descriptiveness of identifier
Change variable for protocols that do not always contain `//` to `noLeadingSlashes` so someone reading the code knows what it means. PR-URL: #12579 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent db5ffa2 commit 3fd009e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/url.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -744,14 +744,14 @@ Url.prototype.resolveObject = function(relative) {
744744
var removeAllDots = mustEndAbs;
745745
var srcPath = result.pathname && result.pathname.split('/') || [];
746746
var relPath = relative.pathname && relative.pathname.split('/') || [];
747-
var psychotic = result.protocol && !slashedProtocol[result.protocol];
747+
var noLeadingSlashes = result.protocol && !slashedProtocol[result.protocol];
748748

749749
// if the url is a non-slashed url, then relative
750750
// links like ../.. should be able
751751
// to crawl up to the hostname, as well. This is strange.
752752
// result.protocol has already been set by now.
753753
// Later on, put the first path part into the host field.
754-
if (psychotic) {
754+
if (noLeadingSlashes) {
755755
result.hostname = '';
756756
result.port = null;
757757
if (result.host) {
@@ -799,7 +799,7 @@ Url.prototype.resolveObject = function(relative) {
799799
// just pull out the search.
800800
// like href='?foo'.
801801
// Put this after the other two cases because it simplifies the booleans
802-
if (psychotic) {
802+
if (noLeadingSlashes) {
803803
result.hostname = result.host = srcPath.shift();
804804
//occasionally the auth can get stuck only in host
805805
//this especially happens in cases like
@@ -880,7 +880,7 @@ Url.prototype.resolveObject = function(relative) {
880880
(srcPath[0] && srcPath[0].charAt(0) === '/');
881881

882882
// put the host back
883-
if (psychotic) {
883+
if (noLeadingSlashes) {
884884
result.hostname = result.host = isAbsolute ? '' :
885885
srcPath.length ? srcPath.shift() : '';
886886
//occasionally the auth can get stuck only in host

0 commit comments

Comments
 (0)