René's URL Explorer Experiment


Title: Redirects with dot in project name do not resolve correctly and raise 404 error instead · Issue #3299 · python-gitlab/python-gitlab · GitHub

Open Graph Title: Redirects with dot in project name do not resolve correctly and raise 404 error instead · Issue #3299 · python-gitlab/python-gitlab

X Title: Redirects with dot in project name do not resolve correctly and raise 404 error instead · Issue #3299 · python-gitlab/python-gitlab

Description: Redirects for projects with dot in name do not resolve correctly When a request is made to GitLab for a project that will be redirected to a new path (HTTP 302 response), a quirk with GitLab's API is that the path_with_namespace passed t...

Open Graph Description: Redirects for projects with dot in name do not resolve correctly When a request is made to GitLab for a project that will be redirected to a new path (HTTP 302 response), a quirk with GitLab's API ...

X Description: Redirects for projects with dot in name do not resolve correctly When a request is made to GitLab for a project that will be redirected to a new path (HTTP 302 response), a quirk with GitLab's ...

Opengraph URL: https://github.com/python-gitlab/python-gitlab/issues/3299

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Redirects with dot in project name do not resolve correctly and raise 404 error instead","articleBody":"## Redirects for projects with dot in name do not resolve correctly\n\nWhen a request is made to GitLab for a project that will be redirected to a new path (HTTP 302 response), a quirk with GitLab's API is that the `path_with_namespace` passed to `https://gitlab.com/api/vi/projects/{encoded_path_with_namespace}` needs to have any dots encoded to `%2E` in order for the `Location` in the response header to be correct. Although this seems to be a \"bug\" with GitLab itself, this package could easily work around it by replacing dots with `%2E` which then makes everything work fine.\n\nWe can demonstrate this pretty simply with the following code, using a project I created and then renamed to demonstrate this behaviour:\n\n```\nimport gitlab\ngl = gitlab.Gitlab(\"https://gitlab.com\")\ngl.projects.get(\"simon.burton1/redirect.test\")\n```\n\nWhich causes:\n\n```\ngitlab.exceptions.GitlabGetError: 404: 404 Project Not Found\n```\n\nWe can see *why* this is happening by repeating the same with curl. First by doing exactly what python-gitlab is doing in `EncodedId` doing by using the url encoded fragment, as `urllib.parse.quote` would return with `safe=\"\"`:\n\n```\ncurl --request GET --url \"https://gitlab.com/api/v4/projects/simon.burton1%2Fredirect.test\"\nThis resource has been moved permanently to https://gitlab.com/api/v4/projects/76187413.test\n```\n\nNote the erroneous `.test` that is added to the redirect message by GitLab. And checking the response headers, we can see that the `Location` does indeed get this erroneous url, which will cause any redirect to ultimately 404, as that path obviously does not exist:\n\n```\n\u003c location: https://gitlab.com/api/v4/projects/76187413.test\n```\n\nHowever, if we encode the dots in the project path, as well as the slashes:\n\n```\ncurl --request GET --url \"https://gitlab.com/api/v4/projects/simon%2Eburton1%2Fredirect%2Etest\"\nThis resource has been moved permanently to https://gitlab.com/api/v4/projects/76187413\n```\n\nAnd we can see that the redirect location header is indeed correct:\n\n```\n\u003c location: https://gitlab.com/api/v4/projects/76187413\n```\n\nWe can validate that this is not a more general issue with API redirects and is limited to this behaviour with dots, by requesting another redirected project that *doesn't* have dots in the `path_with_namespace`, thus:\n\n```\ngl.projects.get(\"gitlab-org/gitlab-ce\")\n\u003cProject id:13083 path_with_namespace:gitlab-org/gitlab-foss\u003e\n```\n\n## Expected Behaviour\n\n`python-gitlab` should encode any dots in `Gitlab.projects.get` as `%2E` to work around the probable bug in GitLab's own API, so that `projects.get(\"redirected.project\")` will return the new project.\n\nAlthough one could argue that this is a bug in GitLab, which may or may not be the case, it's not actually documented about *how* these paths should be encoded, just that they should be \"url encoded\" (https://docs.gitlab.com/api/rest/#namespaced-paths), and encoding dots is not \"wrong\", per se. Just usually unnecessary. \n\nSecondly, we know that even if it were a bug in GitLab's API, they won't fix it for 7 years, and the workaround in `python-gitlab` would be both a valid url encoding anyway, and would enable users of this package to be redirected correctly when requesting moved projects with dots in their namespaced paths.\n\n## Actual Behaviour\n\nA 404 error is returned for an otherwise resolvable redirect when `projects.get(\"redirected.project\")` is called with a dot in the project path, as per this example.\n\n## Suggested Fix\n\nIn `gitlab.utils.EncodedId.__new__()`, updating this line works in this case, but I haven't tested whether this has any knock-on effect for anything else that calls this encoder, so I haven't raised a PR as I cannot prove that there are not regressions without more time to test. Happy to raise a PR though, if you would prefer that:\n\n```\n248        if isinstance(value, str):\n249            value = urllib.parse.quote(value, safe=\"\").replace(\".\", \"%2E\")\n\n```\n\n## Specifications\n\n  - python-gitlab version: 7.0.0\n  - Gitlab server version (or gitlab.com): gitlab.com\n","author":{"url":"https://github.com/uglybug","@type":"Person","name":"uglybug"},"datePublished":"2025-11-18T23:08:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/3299/python-gitlab/issues/3299"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a7141df3-41ab-c833-15d2-3a8f2f322ea1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAD76:242157:9172754:BCC046A:697607FE
html-safe-nonceba29ec015152473dd3b5f50bfdd1643355135912cae2b3754a8044c2dab8fc7f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDc2OjI0MjE1Nzo5MTcyNzU0OkJDQzA0NkE6Njk3NjA3RkUiLCJ2aXNpdG9yX2lkIjoiODE5NTYyNzkyNzA4OTg0MjE3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac5a36b6f657a9e7640417df3ea97074baab4b1c7bce0477c02c74c6afc5067939
hovercard-subject-tagissue:3640336047
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-gitlab/python-gitlab/3299/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4ec24a84e98166bf9ef989880ccd727f1d66c80ea330d330d25ebc8932f9a824/python-gitlab/python-gitlab/issues/3299
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4ec24a84e98166bf9ef989880ccd727f1d66c80ea330d330d25ebc8932f9a824/python-gitlab/python-gitlab/issues/3299
og:image:altRedirects for projects with dot in name do not resolve correctly When a request is made to GitLab for a project that will be redirected to a new path (HTTP 302 response), a quirk with GitLab's API ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameuglybug
hostnamegithub.com
expected-hostnamegithub.com
Nonec6814b4cc7afd45cd6e64525d0cff0e76dd802f315a5b0e55a7abda1d1d070d0
turbo-cache-controlno-preview
go-importgithub.com/python-gitlab/python-gitlab git https://github.com/python-gitlab/python-gitlab.git
octolytics-dimension-user_id28886265
octolytics-dimension-user_loginpython-gitlab
octolytics-dimension-repository_id8077625
octolytics-dimension-repository_nwopython-gitlab/python-gitlab
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id8077625
octolytics-dimension-repository_network_root_nwopython-gitlab/python-gitlab
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4ea235bfed58ef16c8a5642b3ac64b74f10c9f52
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/issues/3299#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-gitlab%2Fpython-gitlab%2Fissues%2F3299
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-gitlab%2Fpython-gitlab%2Fissues%2F3299
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-gitlab%2Fpython-gitlab
Reloadhttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/issues/3299
Reloadhttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/issues/3299
Reloadhttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/issues/3299
python-gitlab https://patch-diff.githubusercontent.com/python-gitlab
python-gitlabhttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-gitlab%2Fpython-gitlab
Fork 675 https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-gitlab%2Fpython-gitlab
Star 2.4k https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-gitlab%2Fpython-gitlab
Code https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab
Issues 26 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/issues
Pull requests 11 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/pulls
Discussions https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions
Actions https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/actions
Projects 0 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/projects
Security 0 https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/security
Insights https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/pulse
Code https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab
Issues https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/issues
Pull requests https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/pulls
Discussions https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/discussions
Actions https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/actions
Projects https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/projects
Security https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/security
Insights https://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/python-gitlab/python-gitlab/issues/3299
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/python-gitlab/python-gitlab/issues/3299
Redirects with dot in project name do not resolve correctly and raise 404 error insteadhttps://patch-diff.githubusercontent.com/python-gitlab/python-gitlab/issues/3299#top
stalehttps://github.com/python-gitlab/python-gitlab/issues?q=state%3Aopen%20label%3A%22stale%22
https://github.com/uglybug
https://github.com/uglybug
uglybughttps://github.com/uglybug
on Nov 18, 2025https://github.com/python-gitlab/python-gitlab/issues/3299#issue-3640336047
https://docs.gitlab.com/api/rest/#namespaced-pathshttps://docs.gitlab.com/api/rest/#namespaced-paths
stalehttps://github.com/python-gitlab/python-gitlab/issues?q=state%3Aopen%20label%3A%22stale%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.