Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #6954

Closed
Open
Created May 11, 2014 by Administrator@rootOwner

404 on API URL for namespace including period because gitlab expects nonstandard URLS (RFC 3986)

Created by: stephens2424

For instance, I have the repository: gitlab.example.com/stephen.searles/myrepo, thus the URL to a path's raw blob would be:

https://gitlab.example.com/api/v3/projects/{ID}/repository/raw_blobs/path?private_token={TOKEN}

where {ID} is {NAMESPACE}/{REPO}. The problem here is that my namespace includes a period character and Gitlab is expecting that period to be URL-encoded. Gitlab responds as such in the following cases:

encoding response status
stephen.searles/php 404
stephen.searles%2Fphp 404
stephen%2Esearles%2Fphp 200

Since the period is an unreserved character, Gitlab should be treating those last two cases the same, per RFC 3986 section 2.3:

URIs that differ in the replacement of an unreserved character with its corresponding percent-encoded US-ASCII octet are equivalent: they identify the same resource. However, URI comparison implementations do not always perform normalization prior to comparison (see Section 6). For consistency, percent-encoded octets in the ranges of ALPHA (%41-%5A and %61-%7A), DIGIT (%7.8-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved characters by URI normalizers.

This causes an issue when using HTTP clients that do standard normalization, requiring you to defeat that process to send Gitlab the nonstandard URLs it expects.

I found this while working with this Gitlab library in Go, but determined it's an artifact of the Go HTTP library's URL normalization process.

Assignee
Assign to
Time tracking