Skip to content

Commit c005ebb

Browse files
Trottjasnell
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: nodejs#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 bcb1d9c commit c005ebb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/url.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,14 +765,14 @@ Url.prototype.resolveObject = function resolveObject(relative) {
765765
var removeAllDots = mustEndAbs;
766766
var srcPath = result.pathname && result.pathname.split('/') || [];
767767
var relPath = relative.pathname && relative.pathname.split('/') || [];
768-
var psychotic = result.protocol && !slashedProtocol[result.protocol];
768+
var noLeadingSlashes = result.protocol && !slashedProtocol[result.protocol];
769769

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

903903
// put the host back
904-
if (psychotic) {
904+
if (noLeadingSlashes) {
905905
result.hostname = result.host = isAbsolute ? '' :
906906
srcPath.length ? srcPath.shift() : '';
907907
//occasionally the auth can get stuck only in host

0 commit comments

Comments
 (0)