Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-ds-flatfs
Commits
b938a28d
Commit
b938a28d
authored
Jan 16, 2017
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always require the prefix in shard identifier.
parent
a156e6fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
shard.go
shard.go
+5
-6
No files found.
shard.go
View file @
b938a28d
...
@@ -73,13 +73,12 @@ func ParseShardFunc(str string) (*ShardIdV1, error) {
...
@@ -73,13 +73,12 @@ func ParseShardFunc(str string) (*ShardIdV1, error) {
if
len
(
str
)
==
0
{
if
len
(
str
)
==
0
{
return
nil
,
fmt
.
Errorf
(
"empty shard identifier"
)
return
nil
,
fmt
.
Errorf
(
"empty shard identifier"
)
}
}
if
str
[
0
]
==
'/'
{
trimmed
:=
strings
.
TrimPrefix
(
str
,
PREFIX
)
trimmed
:=
strings
.
TrimPrefix
(
str
,
PREFIX
)
if
str
==
trimmed
{
// nothing trimmed
if
str
==
trimmed
{
// nothing trimmed
return
nil
,
fmt
.
Errorf
(
"invalid prefix in shard identifier: %s"
,
str
)
return
nil
,
fmt
.
Errorf
(
"invalid or no prefix in shard identifier: %s"
,
str
)
}
str
=
trimmed
}
}
str
=
trimmed
parts
:=
strings
.
Split
(
str
,
"/"
)
parts
:=
strings
.
Split
(
str
,
"/"
)
if
len
(
parts
)
!=
3
{
if
len
(
parts
)
!=
3
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment