Numerical characters are stripped from diffusion Git repository name in the URI


#1

Observed Behavior:
When creating a repository with numbers in the name, these numbers are stripped from the name when the default URLs are created.

When performing a git clone of a diffusion repository, numbers will be stripped from the repository name, allowing invalid URLs to clone a repository.

Expected Behavior:
Although Diffusion does not allow numbers in the callsign, they are allowed in the repository name and repository short name.
Links to a repository with numerical characters in the name should be included and correctly parsed.

Phabricator Version:
phabricator 8ada2bc4fe74423674bce4df0b7f3a144a2c771d (Wed, May 9) (branched from 4a98e0ff65a44a208920f553a935f734726e93b2 on origin)
arcanist 8794ce1eaca0b3ef020e2cd5d2d5479fd3626b9f (Fri, Apr 27) (branched from a604548101025875de20a9c263df3790fea425b3 on origin)
phutil f3e10579f640ebad648c56f677164647ab7251a4 (Sat, Apr 14) (branched from 20eff1c8d14f08f05ef72828fa379e871d29662c on origin)
sprint 9da8f6c3f27282aa10375bb97592cbe86db99d24 (Nov 29 2017)
diff: 3.3 at /usr/bin/diff
git 2.7.4 at /usr/bin/git
hg Not Available
pygmentize 2.1.3 at /usr/local/bin/pygmentize
svn 1.9.3 at /usr/bin/svn

Reproduction Steps:

  1. Create a new empty git repository:
    Go to Diffusion
    Click “Create Repository”
    Fill in the details:
    Name: abc123def Callsign: GHI
    Click “Create Repository”

  2. Check the default URIs
    Click “URIs”
    They will be something like ssh://git@phabricator.mycompany.com:2222/diffusion/GHI/abcdef.git
    note: the numbers in the repository name have been stripped from the URI

  3. Activate the repository
    Click “Basics”
    Click “Actions” > “Activate Repository”

  4. Insert numbers when cloning the repository
    git clone ssh://git@phabricator.mycompany.com:2222/diffusion/GHI/abc456def.git
    note: the command will work, even though invalid numbers have been added to the URI


#2

:+1:

The last item - using a different name after the callsign - is expected, we ignore that part and only include it so that the directory name when cloning isn’t ugly.

We do some stripping on the short name to make sure it’s a valid uri and filename, but I think we should allow digits.


#3

See https://secure.phabricator.com/D19447


#4

Fantastic, thanks very much!
And thanks for the explanation on the last point, I didn’t realise that.