GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — url: fixing url resolve issue by amir-s · Pull Request #278 · nodejs/node

Conversation

@amir-s

@amir-s amir-s commented Jan 10, 2015

Copy link
Copy Markdown
Contributor

url.resolve('/path/to/file', '.') should return /path/to/ with the trailing slash.
Also url.resolve('/', '.') should return /.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bnoordhuis
bnoordhuis reviewed Jan 10, 2015
View reviewed changes
Comment thread lib/url.js Outdated

@bnoordhuis bnoordhuis Jan 10, 2015

Copy link
Copy Markdown
Member

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.

Style: long lines should wrap at 80 columns. make jslint will warn you about that.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bnoordhuis

bnoordhuis commented Jan 10, 2015

Copy link
Copy Markdown
Member

Does make test pass with this change? And can you add a few new tests to test/parallel/test-url.js? Thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amir-s

amir-s commented Jan 11, 2015

Copy link
Copy Markdown
Contributor Author

@bnoordhuis Yes, it passes the tests. I've styled the code, thanks for mentioning it.
I also added some tests.
Thanks ;)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Jan 11, 2015

Copy link
Copy Markdown
Member

@amir-s Thanks. One more thing, can you squash the commits and reword the commit log to something that conforms to the contributing guide? (Check git log lib/url.js if you want some examples.)

Can someone who uses the url module on a daily basis chime in? This PR changes the result of e.g. url.resolve('/a/b/', '..') from '/a' to '/a/'. I'm unclear if that is the desired behavior. If nothing else, it diverges from joyent/node.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ljharb

ljharb commented Jan 11, 2015

Copy link
Copy Markdown
Member

Would it be out of the question to make url be an independent module? That way, iojs shipping this as a breaking change wouldn't have to break code that also ran on node, since any project could just add url as a dependency.

(I note that https://www.npmjs.com/package/url already exists, but not sure if that changes anything)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amir-s
url: resloving urls without hostname with . & ..
0dade15
@amir-s
amir-s force-pushed the v1.x branch from bec3df7 to 0dade15 Compare January 11, 2015 22:10
@amir-s

amir-s commented Jan 11, 2015

Copy link
Copy Markdown
Contributor Author

@bnoordhuis @ljharb
As . and .. are directory specs, the returned string should be a directory, so it should end with a slash.
I just created a pull request in node's repo to address the issue, we can wait for them to merge it (nodejs/node-v0.x-archive#9010)

About the url package that already exists in npm, it is just a copy of node's url module for using it with Browserify.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisdickinson

chrisdickinson commented Jan 11, 2015

Copy link
Copy Markdown
Contributor

Chiming in here: the goal for the url module is to move towards WHATWG compliance. The dot behavior here seems to be in line with the intent of that spec as I understand it. +1.

@ljharb:

Would it be out of the question to make url be an independent module? That way, iojs shipping this as a breaking change wouldn't have to break code that also ran on node, since any project could just add url as a dependency.

Two things to consider:

  1. The package would have to be named something other than url, since core modules take precedence over local packages.
  2. Diverging iojs' url will diverge other APIs that depend on it -- namely, tls, http, and https. A user will not avoid incompatibility by explicitly depending on a userland version of an API, since the API may be used to implement other core APIs.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ljharb

ljharb commented Jan 12, 2015

Copy link
Copy Markdown
Member

Makes sense - those are both pretty solid things to consider.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Jan 12, 2015

Copy link
Copy Markdown
Contributor

My vote is to let the PR on joyent/node run its course. If it gets merged then io.js will get it eventually. If it is rejected, we can reevaluate. I'm +1 on increasing WHATWG compliance.

EDIT: Of course, then we also run the risk of the joyent/node PR sitting indefinitely.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amir-s amir-s changed the title fixing url resolve issue url: fixing url resolve issue Jan 14, 2015
@trevnorris trevnorris added the url Issues and PRs related to the legacy built-in url module. label Jan 22, 2015
@brendanashworth brendanashworth added the semver-major PRs that contain breaking changes and should be released in the next major version. label Feb 1, 2015
@Fishrock123

Fishrock123 commented Feb 10, 2015

Copy link
Copy Markdown
Contributor

@cjihrig Looks like the node PR was landed v0.10 by @trevnorris

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Feb 13, 2015
Currently missing commits from joyent/node #832
Closed
Cherrypick commits from joyent/node #834
Closed
@Fishrock123

Fishrock123 commented Feb 13, 2015

Copy link
Copy Markdown
Contributor

@cjihrig given this landed in node, is this actually semver-major?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Feb 13, 2015

Copy link
Copy Markdown
Contributor

I would say no. Since it landed in 0.10, I would consider it a bug fix.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123 Fishrock123 removed the semver-major PRs that contain breaking changes and should be released in the next major version. label Feb 13, 2015
cjihrig pushed a commit that referenced this pull request Feb 13, 2015
@amir-s @cjihrig
url: reslove urls with . and ..
faa687b
'.' and '..' are directory specs and resolving urls with or
without the hostname with '.' and '..' should add a trailing
slash to the end of the url.

Fixes: nodejs/node-v0.x-archive#8992
PR-URL: #278
Reviewed-By: Trevor Norris <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@cjihrig

cjihrig commented Feb 13, 2015

Copy link
Copy Markdown
Contributor

Thanks. Landed in faa687b

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig cjihrig closed this Feb 13, 2015
@rvagg rvagg mentioned this pull request Feb 18, 2015
Release proposal: v1.3.0 #872
Closed
rvagg added a commit that referenced this pull request Feb 20, 2015
@rvagg
2015-02-20 io.js v1.3.0 Release
1d7a47f
Notable changes:

* url: `url.resolve('/path/to/file', '.')` now returns `/path/to/`
  with the trailing slash, `url.resolve('/', '.')` returns `/`.
  #278 (Amir Saboury)
* tls: tls (and in turn https) now rely on a stronger default
  cipher suite which excludes the RC4 cipher. If you still want to
  use RC4, you have to specify your own ciphers suite.
  #826 (Roman Reiss)
@thekidfrankensteinthrewinapond

thekidfrankensteinthrewinapond commented Feb 20, 2015

Copy link
Copy Markdown

@cjihrig This is a breaking change, here's the documentation: https://iojs.org/api/url.html#url_url_resolve_from_to

Why is this not in 2.0?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Feb 20, 2015

Copy link
Copy Markdown
Contributor

I would classify this as a bug fix. Unfortunately, bug fixes sometimes change behavior. The fact that it went into the 0.10 (stable) branch of Node.js further convinced me that it didn't warrant a major version bump. I apologize if this caused you any problems.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thekidfrankensteinthrewinapond

thekidfrankensteinthrewinapond commented Feb 20, 2015

Copy link
Copy Markdown

It doesn't matter if it is a bug fix or not, it's backwards-incompatible.

http://semver.org/

MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.

Is io.js not following semver now?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnb bnb mentioned this pull request Feb 20, 2015
Evangelism: Weekly Update Feb 20th nodejs/iojs.org#188
Closed
This was referenced Sep 7, 2015
Update dependency and add missing istanbul dependency apigee-127/swagger-converter#47
Merged
Publish native modules independently. #2729
Closed
@aliceUnhinged613 aliceUnhinged613 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities aliceUnhinged613/node#118
Open
@ryan-ally ryan-ally mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities ryan-ally/node#99
Open
@jen801 jen801 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities jen801/node#34
Open
@wedataintelligence wedataintelligence mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities wedataintelligence/node#101
Open
@adamlaska adamlaska mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities adamlaska/node#140
Open
@baby636 baby636 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities baby636/node#132
Open
@ron-a20 ron-a20 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities ron-a20/node#116
Open
@amacsnyk amacsnyk mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities amacsnyk/node#19
Closed
@jhudaz jhudaz mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities jhudaz/node#64
Open
@PinkDiamond1 PinkDiamond1 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities PinkDiamond1/node#33
Open
This was referenced Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities pratapadi/node#102
Open
[Snyk] Security upgrade pacote from 11.3.5 to 16.0.0 pratapadi/node#104
Open
@awaisab172 awaisab172 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities awaisab172/node#56
Open
@yotamselementor yotamselementor mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities yotamselementor/node#40
Open
@RoeeOren RoeeOren mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities RoeeOren/node#50
Open
@pratapadi pratapadi mentioned this pull request Feb 11, 2024
[Snyk] Security upgrade pacote from 11.3.5 to 16.0.0 pratapadi/node#107
Open
@Matthelonianxl Matthelonianxl mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities Matthelonianxl/node#64
Open
@Verdinjoshua26 Verdinjoshua26 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities Verdinjoshua26/node#59
Open
@thisguy726 thisguy726 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities thisguy726/node#20
Open
@terrorizer1980 terrorizer1980 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities terrorizer1980/node-1#19
Open
@kaocher82 kaocher82 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities Xtuden-com/node#44
Open
@sirinartk sirinartk mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities sirinartk/node#55
Open
@pratapadi pratapadi mentioned this pull request Feb 12, 2024
[Snyk] Security upgrade pacote from 11.3.5 to 16.0.0 pratapadi/node#109
Open
@timzwit timzwit mentioned this pull request Feb 12, 2024
[Snyk] Fix for 1 vulnerabilities timzwit/node#37
Open
@MrBrain295 MrBrain295 mentioned this pull request Feb 12, 2024
[Snyk] Fix for 1 vulnerabilities MrBrain295/node#32
Open
@kissofire kissofire mentioned this pull request Feb 12, 2024
[Snyk] Fix for 1 vulnerabilities kissofire/node#120
Open
@molllyn1 molllyn1 mentioned this pull request Feb 12, 2024
[Snyk] Fix for 1 vulnerabilities molllyn1/node#103
Open
@137717unity 137717unity mentioned this pull request Feb 12, 2024
[Snyk] Fix for 1 vulnerabilities 137717unity/node#119
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

url Issues and PRs related to the legacy built-in url module.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

11 participants

@amir-s @bnoordhuis @ljharb @chrisdickinson @cjihrig @Fishrock123 @thekidfrankensteinthrewinapond @abritinthebay @rvagg @trevnorris @brendanashworth
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.