Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
jio
Commits
447c8c4d
Commit
447c8c4d
authored
Dec 26, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhance error detection accuracy
parent
73508dd2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
6 deletions
+39
-6
src/jio/commands/command.js
src/jio/commands/command.js
+9
-2
src/jio/commands/getCommand.js
src/jio/commands/getCommand.js
+1
-1
src/jio/commands/postCommand.js
src/jio/commands/postCommand.js
+1
-1
src/jio/commands/putAttachmentCommand.js
src/jio/commands/putAttachmentCommand.js
+1
-1
src/jio/commands/putCommand.js
src/jio/commands/putCommand.js
+1
-1
src/jio/commands/removeCommand.js
src/jio/commands/removeCommand.js
+26
-0
No files found.
src/jio/commands/command.js
View file @
447c8c4d
...
@@ -21,7 +21,7 @@ var command = function(spec, my) {
...
@@ -21,7 +21,7 @@ var command = function(spec, my) {
priv
.
tried
=
0
;
priv
.
tried
=
0
;
priv
.
doc
=
spec
.
doc
||
{};
priv
.
doc
=
spec
.
doc
||
{};
priv
.
docid
=
spec
.
docid
||
spec
.
doc
.
_id
||
''
;
priv
.
docid
=
spec
.
docid
||
priv
.
doc
.
_id
;
priv
.
option
=
spec
.
options
||
{};
priv
.
option
=
spec
.
options
||
{};
priv
.
callbacks
=
spec
.
callbacks
||
{};
priv
.
callbacks
=
spec
.
callbacks
||
{};
priv
.
success
=
priv
.
callbacks
.
success
||
function
(){};
priv
.
success
=
priv
.
callbacks
.
success
||
function
(){};
...
@@ -75,6 +75,9 @@ var command = function(spec, my) {
...
@@ -75,6 +75,9 @@ var command = function(spec, my) {
* @return {string} The document id
* @return {string} The document id
*/
*/
that
.
getDocId
=
function
()
{
that
.
getDocId
=
function
()
{
if
(
typeof
priv
.
docid
!==
"
string
"
)
{
return
undefined
;
}
return
priv
.
docid
.
split
(
'
/
'
)[
0
];
return
priv
.
docid
.
split
(
'
/
'
)[
0
];
};
};
...
@@ -84,6 +87,9 @@ var command = function(spec, my) {
...
@@ -84,6 +87,9 @@ var command = function(spec, my) {
* @return {string} The attachment id
* @return {string} The attachment id
*/
*/
that
.
getAttachmentId
=
function
()
{
that
.
getAttachmentId
=
function
()
{
if
(
typeof
priv
.
docid
!==
"
string
"
)
{
return
undefined
;
}
return
priv
.
docid
.
split
(
'
/
'
)[
1
];
return
priv
.
docid
.
split
(
'
/
'
)[
1
];
};
};
...
@@ -157,7 +163,8 @@ var command = function(spec, my) {
...
@@ -157,7 +163,8 @@ var command = function(spec, my) {
* @param {object} storage The storage.
* @param {object} storage The storage.
*/
*/
that
.
validate
=
function
(
storage
)
{
that
.
validate
=
function
(
storage
)
{
if
(
!
priv
.
docid
.
match
(
/^
[^\/]
+
([\/][^\/]
+
)?
$/
))
{
if
(
typeof
priv
.
docid
===
"
string
"
&&
!
priv
.
docid
.
match
(
/^
[^\/]
+
([\/][^\/]
+
)?
$/
))
{
that
.
error
({
that
.
error
({
status
:
21
,
statusText
:
'
Invalid Document Id
'
,
status
:
21
,
statusText
:
'
Invalid Document Id
'
,
error
:
'
invalid_document_id
'
,
error
:
'
invalid_document_id
'
,
...
...
src/jio/commands/getCommand.js
View file @
447c8c4d
...
@@ -9,7 +9,7 @@ var getCommand = function(spec, my) {
...
@@ -9,7 +9,7 @@ var getCommand = function(spec, my) {
};
};
that
.
validateState
=
function
()
{
that
.
validateState
=
function
()
{
if
(
typeof
that
.
getDocId
()
===
"
string
"
&&
that
.
getDocId
()
===
""
)
{
if
(
!
(
typeof
that
.
getDocId
()
===
"
string
"
&&
that
.
getDocId
()
!==
""
)
)
{
that
.
error
({
that
.
error
({
"
status
"
:
20
,
"
status
"
:
20
,
"
statusText
"
:
"
Document Id Required
"
,
"
statusText
"
:
"
Document Id Required
"
,
...
...
src/jio/commands/postCommand.js
View file @
447c8c4d
...
@@ -15,7 +15,7 @@ var postCommand = function(spec, my) {
...
@@ -15,7 +15,7 @@ var postCommand = function(spec, my) {
that
.
error
({
that
.
error
({
"
status
"
:
21
,
"
status
"
:
21
,
"
statusText
"
:
"
Invalid Document Id
"
,
"
statusText
"
:
"
Invalid Document Id
"
,
"
error
"
:
"
Invalid Document I
d
"
,
"
error
"
:
"
invalid_document_i
d
"
,
"
message
"
:
"
The document id contains '/' characters
"
+
"
message
"
:
"
The document id contains '/' characters
"
+
"
which are forbidden
"
,
"
which are forbidden
"
,
"
reason
"
:
"
Document id contains '/' character(s)
"
"
reason
"
:
"
Document id contains '/' character(s)
"
...
...
src/jio/commands/putAttachmentCommand.js
View file @
447c8c4d
...
@@ -13,7 +13,7 @@ var putAttachmentCommand = function(spec, my) {
...
@@ -13,7 +13,7 @@ var putAttachmentCommand = function(spec, my) {
};
};
that
.
validateState
=
function
()
{
that
.
validateState
=
function
()
{
if
(
typeof
that
.
getAttachmentId
()
===
"
undefined
"
)
{
if
(
typeof
that
.
getAttachmentId
()
!==
"
string
"
)
{
that
.
error
({
that
.
error
({
"
status
"
:
22
,
"
status
"
:
22
,
"
statusText
"
:
"
Attachment Id Required
"
,
"
statusText
"
:
"
Attachment Id Required
"
,
...
...
src/jio/commands/putCommand.js
View file @
447c8c4d
...
@@ -11,7 +11,7 @@ var putCommand = function(spec, my) {
...
@@ -11,7 +11,7 @@ var putCommand = function(spec, my) {
};
};
that
.
validateState
=
function
()
{
that
.
validateState
=
function
()
{
if
(
typeof
that
.
getDocId
()
===
"
string
"
&&
that
.
getDocId
()
===
""
)
{
if
(
!
(
typeof
that
.
getDocId
()
===
"
string
"
&&
that
.
getDocId
()
!==
""
)
)
{
that
.
error
({
that
.
error
({
"
status
"
:
20
,
"
status
"
:
20
,
"
statusText
"
:
"
Document Id Required
"
,
"
statusText
"
:
"
Document Id Required
"
,
...
...
src/jio/commands/removeCommand.js
View file @
447c8c4d
...
@@ -8,6 +8,32 @@ var removeCommand = function(spec, my) {
...
@@ -8,6 +8,32 @@ var removeCommand = function(spec, my) {
return
'
remove
'
;
return
'
remove
'
;
};
};
that
.
validateState
=
function
()
{
if
(
!
(
typeof
that
.
getDocId
()
===
"
string
"
&&
that
.
getDocId
()
!==
""
))
{
that
.
error
({
"
status
"
:
20
,
"
statusText
"
:
"
Document Id Required
"
,
"
error
"
:
"
document_id_required
"
,
"
message
"
:
"
The document id is not provided
"
,
"
reason
"
:
"
Document id is undefined
"
});
return
false
;
}
if
(
typeof
that
.
getAttachmentId
()
===
"
string
"
)
{
if
(
that
.
getAttachmentId
()
===
""
)
{
that
.
error
({
"
status
"
:
23
,
"
statusText
"
:
"
Invalid Attachment Id
"
,
"
error
"
:
"
invalid_attachment_id
"
,
"
message
"
:
"
The attachment id must not be an empty string
"
,
"
reason
"
:
"
Attachment id is empty
"
});
}
return
false
;
}
return
true
;
};
that
.
executeOn
=
function
(
storage
)
{
that
.
executeOn
=
function
(
storage
)
{
storage
.
remove
(
that
);
storage
.
remove
(
that
);
};
};
...
...
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