You should look at the RFC he references Peter. The rules for merging URI's are not quite as straightforward as you would guess. Looking at the samples in the RFC, it looks like Andrew's gotten his code right and it looks like Path.join would not serve the need.
-- Onorio On Thu, May 19, 2016 at 1:35 AM, Peter Hamilton <[email protected]> wrote: > What's missing from Path.join? > > iex(1)> Path.join("http://google.com", "/bar") > "http://google.com/bar" > iex(2)> Path.join("http://google.com/", "/bar") > "http://google.com/bar" > iex(3)> Path.join("http://google.com/foo", "/bar") > "http://google.com/foo/bar" > iex(4)> Path.join("http://google.com/foo", "bar") > "http://google.com/foo/bar" > > If something, the new function should definitely be URI.join > > On Wed, May 18, 2016 at 10:09 PM Andrew Timberlake < > [email protected]> wrote: > >> I’ve made changes picked up from RFC3986 and submitted a pull request, >> https://github.com/elixir-lang/elixir/pull/4644 >> >> Andrew >> >> >> On 19 May 2016, at 07:03, Andrew Timberlake <[email protected]> >> wrote: >> >> Jon >> >> RFC3986 refers to the process as merging in §5.2 >> “The pseudocode above refers to a "merge" routine for merging a >> relative-path reference with the path of the base URI” >> >> But, I’m indifferent about the naming. >> >> Andrew >> >> On 19 May 2016, at 02:05, Jon Parise <[email protected]> wrote: >> >> A minor piece of feedback, but have you considered naming this URI.join/2? >> >> That would be consistent with similar functions in Python >> (urlparse.urljoin) and Ruby (URI.join). >> >> On Wed, May 18, 2016 at 12:21 PM, Andrew Timberlake < >> [email protected]> wrote: >> >>> Example: >>> >>> iex> URI.merge("http://example.com/foo", "/bar") |> to_string >>> "http://example.com/bar" >>> >>> iex> URI.parse("http://example.com/foo") |> URI.merge("/bar") |> >>> to_string >>> "http://example.com/bar" >>> >>> …and more >>> >>> I have written the code based on RFC2396 §5.2 and would like to send >>> through a pull request. >>> >>> Andrew >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elixir-lang-core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elixir-lang-core/C1FD35C2-B4C6-4701-83AC-F0F1FA656E1D%40andrewtimberlake.com >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/CAPdFhdVX1inBx8TV7Q32rDLYetiydfHXk1isBRWn_GkL2erXhA%40mail.gmail.com >> <https://groups.google.com/d/msgid/elixir-lang-core/CAPdFhdVX1inBx8TV7Q32rDLYetiydfHXk1isBRWn_GkL2erXhA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/4AADBC83-0BBB-40DC-A69E-5B09CF32ABB4%40andrewtimberlake.com >> <https://groups.google.com/d/msgid/elixir-lang-core/4AADBC83-0BBB-40DC-A69E-5B09CF32ABB4%40andrewtimberlake.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "elixir-lang-core" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/elixir-lang-core/d4oY2p1wFbk/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CAOMhEnzjo23afXNYZ0ZviJYBmaxMSgJef%3DEsBoXGyq5SFikuPg%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAOMhEnzjo23afXNYZ0ZviJYBmaxMSgJef%3DEsBoXGyq5SFikuPg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Onorio Catenacci http://onor.io http://www.google.com/+OnorioCatenacci -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAP%3DvNq8Jwb1KQwBxbUgpgV%3D9yJPMvBpmX%3DFpG7HN6dyRqpjRKA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
