diff --git a/cmd/fsi_integration_test.go b/cmd/fsi_integration_test.go index d1b556545..990f98c20 100644 --- a/cmd/fsi_integration_test.go +++ b/cmd/fsi_integration_test.go @@ -150,7 +150,7 @@ func TestInitBadName(t *testing.T) { _ = run.CreateAndChdirToWorkDir("invalid_dataset_name") // Init with an invalid dataset name - err := run.ExecCommand("qri init --name invalid-dataset-name --format csv") + err := run.ExecCommand("qri init --name invalid=dataset=name --format csv") if err == nil { t.Fatal("expected error trying to init, did not get an error") } diff --git a/dsref/parse.go b/dsref/parse.go index 5ebefc06f..56c384da5 100644 --- a/dsref/parse.go +++ b/dsref/parse.go @@ -31,8 +31,8 @@ import ( // /ipfs/QmSome1Commit2Hash3 const ( - alphaNumeric = `[a-zA-Z]\w*` - alphaNumericDsname = `[a-zA-Z]\w{0,143}` + alphaNumeric = `[a-zA-Z][\w-]*` + alphaNumericDsname = `[a-zA-Z][\w-]{0,143}` b58Id = `Qm[0-9a-zA-Z]{0,44}` ) diff --git a/dsref/parse_test.go b/dsref/parse_test.go index 558f36df7..d17612b1a 100644 --- a/dsref/parse_test.go +++ b/dsref/parse_test.go @@ -15,6 +15,8 @@ func TestParse(t *testing.T) { {"right hand side", "@QmFirst/ipfs/QmSecond", Ref{ProfileID: "QmFirst", Path: "/ipfs/QmSecond"}}, {"just path", "@/ipfs/QmSecond", Ref{Path: "/ipfs/QmSecond"}}, {"long name", "peer/some_name@/map/QmXATayrFgsS3tpCi2ykfpNJ8uiCWT74dttnvJvVo1J7Rn", Ref{Username: "peer", Name: "some_name", Path: "/map/QmXATayrFgsS3tpCi2ykfpNJ8uiCWT74dttnvJvVo1J7Rn"}}, + {"name-has-dash", "abc/my-dataset", Ref{Username: "abc", Name: "my-dataset"}}, + {"dash-in-username", "some-user/my_dataset", Ref{Username: "some-user", Name: "my_dataset"}}, } for i, c := range goodCases { ref, err := Parse(c.text) @@ -41,6 +43,8 @@ func TestParse(t *testing.T) { {"local filename", "foo.json", "parsing ref, unexpected character at position 0: 'f'"}, {"absolute filepath", "/usr/local/bin/file.cbor", "parsing ref, unexpected character at position 0: '/'"}, {"absolute dirname", "/usr/local/bin", "parsing ref, unexpected character at position 0: '/'"}, + {"dot in dataset", "abc/data.set", "parsing ref, unexpected character at position 8: '.'"}, + {"equals in dataset", "abc/my=ds", "parsing ref, unexpected character at position 6: '='"}, } for i, c := range badCases { _, err := Parse(c.text)