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

fix(core): add new to url call #153

Merged
merged 2 commits into from
Feb 4, 2020
Merged

fix(core): add new to url call #153

merged 2 commits into from
Feb 4, 2020

Conversation

xavdid
Copy link
Contributor

@xavdid xavdid commented Feb 3, 2020

fixes the problem described here

it doesn't look like we've got any testing here, which is why this may have gone undetected so long? I'm also puzzled at why this would have worked at all recently and only broke when we did the godzilla core 8 -> upgrade. In any case, this will fix the issue.

@xavdid xavdid requested a review from eliangcs as a code owner February 3, 2020 21:40
@kgodtfredsen
Copy link
Contributor

Copy link
Member

@eliangcs eliangcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing!

Copy link
Member

@eliangcs eliangcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just found an issue with the attribute name. I'll add a test before we cut a release.

@@ -15,7 +15,7 @@ const buildDigestHeader = (username, password, url, method, creds) => {
);
}

const path = urllib.URL(url).path;
const path = new urllib.URL(url).path;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like path is not a valid attribute of the URL object.

> const { URL } = require('url')
undefined
> new URL('https://example.com/test/foo').path
undefined
> new URL('https://example.com/test/foo').pathname
'/test/foo'

We should use pathname:

Suggested change
const path = new urllib.URL(url).path;
const path = new urllib.URL(url).pathname;

@xavdid
Copy link
Contributor Author

xavdid commented Feb 4, 2020 via email

@eliangcs
Copy link
Member

eliangcs commented Feb 4, 2020

@xavdid looking into the git history, that line was originally urllib.parse(url).path (which worked) and got edited to urllib.URL(url).path in PR #46. URL(url).path is not a valid usage, not even on Node 8. It's been there since 8.3.0, so that means digest auth has been broken since 8.3.0. 🤦‍♂

@xavdid
Copy link
Contributor Author

xavdid commented Feb 4, 2020

🙈 I guess digest auth isn't super popular

@eliangcs eliangcs merged commit 70b4761 into master Feb 4, 2020
@eliangcs eliangcs deleted the fix-digest branch February 4, 2020 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants