-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Fixing getting local files (file://) failed #2470
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
Conversation
lib/core/settle.js
Outdated
| var validateStatus = response.config.validateStatus; | ||
| if (!validateStatus || validateStatus(response.status)) { | ||
| var responseUrl = response.config.url; | ||
| if (!validateStatus || validateStatus(response.status) || (!response.status && ~responseUrl.indexOf('file:'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tilde bitwise logic returns -1 when the string doesn't match and 0 when it matches, I believe it will always be false? unless I'm missing something
> myString = "test123"
"test123"
> ~myString.indexOf("test");
-1
> ~myString.indexOf("notpresent");
0You can just do the normal .indexOf('file:') >= 0 or something similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi, -1 is true rather than false...
var i = -1;
if (i) {
console.log(i, " is true");
} else {
console.log(i, " is false");
}
it will ouput: -1 ' is true'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ right
|
and about the build, we're working on it, hopefully we have it passing soon |
|
Thanks @yasuf ! |
|
Hi @yasuf , since you have approved this PR, will you merge it? |
fixing issue #2416 and #2396