Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 00b6646

Browse filesBrowse files
TrottMylesBorins
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 0bd0d52 commit 00b6646
Copy full SHA for 00b6646

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Collapse file

‎lib/url.js‎

Copy file name to clipboardExpand all lines: lib/url.js
+4-4Lines changed: 4 additions & 4 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.