{"id":21547965,"url":"https://github.com/jean-lourenco/urlcombine","last_synced_at":"2025-07-11T02:39:50.943Z","repository":{"id":54466770,"uuid":"89023442","full_name":"jean-lourenco/UrlCombine","owner":"jean-lourenco","description":"C# util for combining Url paths. Works similarly to Path.Combine.","archived":false,"fork":false,"pushed_at":"2020-06-25T10:25:21.000Z","size":25,"stargazers_count":29,"open_issues_count":4,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-13T14:57:47.526Z","etag":null,"topics":["combine","uri","url","util"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jean-lourenco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-21T21:03:31.000Z","updated_at":"2025-02-21T23:26:20.000Z","dependencies_parsed_at":"2022-08-13T16:31:15.687Z","dependency_job_id":null,"html_url":"https://github.com/jean-lourenco/UrlCombine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jean-lourenco/UrlCombine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jean-lourenco%2FUrlCombine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jean-lourenco%2FUrlCombine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jean-lourenco%2FUrlCombine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jean-lourenco%2FUrlCombine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jean-lourenco","download_url":"https://codeload.github.com/jean-lourenco/UrlCombine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jean-lourenco%2FUrlCombine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264713892,"owners_count":23652924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["combine","uri","url","util"],"created_at":"2024-11-24T06:16:54.683Z","updated_at":"2025-07-11T02:39:50.927Z","avatar_url":"https://github.com/jean-lourenco.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UrlCombine [![Build Status](https://travis-ci.org/jean-lourenco/UrlCombine.svg?branch=master)](https://travis-ci.org/jean-lourenco/UrlCombine)\nThe UrlCombine is a [Nuget Package](https://www.nuget.org/packages/UrlCombine) to conveniently combine your base Url and relative url.\nThis library treats the slashes between the base and relative paths to ensure a valid url.\n\n``` csharp\n  using UrlCombineLib;\n```\n\n**There are 3 ways to use the library:**\n\n## Static Method\nThe static method is used with UrlCombine helper class.\nIt doesn't matter if the baseUrl and relativePath end/start with a slash or not, The Combine() method takes care of that:\n\n``` csharp\n  var fullUrl = UrlCombine.Combine(\"www.foo.com.br/\", \"/bar/zeta\");\n  // fullUrl = \"www.foo.com.br/bar/zeta\"\n```\n\n## String Extension\nThe string extesion is used with the CombineUrl method:\n\n``` csharp\n  var fullUrl = \"www.foo.com.br/\".CombineUrl(\"/bar/zeta\");\n  // fullUrl = \"www.foo.com.br/bar/zeta\"\n```\n\n## Uri Extension\nThe Uri extension is used with the Combine method:\n\n``` csharp\n  var fullUrl = new Uri(\"www.foo.com.br/\").Combine(\"/bar/zeta\");\n  // fullUrl = new Uri(\"www.foo.com.br/bar/zeta\")\n```\n\n## Multiple relative paths in runtime\nThere's also a UrlCombine.Combine overload (alongside Uri and String extension methods) that takes a param string[] as input:\n\n``` csharp\n  var fullUrl = new Uri(\"www.foo.com.br/\").Combine(\"bar\", \"zeta\");\n  // fullUrl = new Uri(\"www.foo.com.br/bar/zeta\")\n```\n\n## Why not Uri(Uri base, string relative)?\nWell, It does more than just validate the slashes. It strips the relative path of the base Uri if it doesn't end with a slash and if the relative path doesn't start with one:\n``` csharp\n  var uriBase = new Uri(\"http://www.foo.com/relative\");\n  var relative = \"/other/url\";\n  \n  var uri = new Uri(uriBase, relative);\n  // uri.ToString() = \"http://www.foo.com/other/url\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjean-lourenco%2Furlcombine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjean-lourenco%2Furlcombine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjean-lourenco%2Furlcombine/lists"}