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
Vincent Bechu
jio
Commits
8f5eb06b
Commit
8f5eb06b
authored
Aug 27, 2015
by
lucas.parsy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
davstorage: return 404 status when putAttachment into an inexistent repository
parent
d85fc772
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
5 deletions
+39
-5
src/jio.storage/davstorage.js
src/jio.storage/davstorage.js
+16
-5
test/jio.storage/davstorage.tests.js
test/jio.storage/davstorage.tests.js
+23
-0
No files found.
src/jio.storage/davstorage.js
View file @
8f5eb06b
...
...
@@ -196,13 +196,24 @@
DavStorage
.
prototype
.
putAttachment
=
function
(
id
,
name
,
blob
)
{
var
that
=
this
;
id
=
restrictDocumentId
(
id
);
restrictAttachmentId
(
name
);
return
ajax
(
this
,
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
ajax
(
that
,
{
type
:
"
PUT
"
,
url
:
this
.
_url
+
id
+
name
,
url
:
that
.
_url
+
id
+
name
,
data
:
blob
});
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
target
.
status
===
403
)
{
throw
new
jIO
.
util
.
jIOError
(
"
Cannot access subdocument
"
,
404
);
}
throw
error
;
});
};
DavStorage
.
prototype
.
getAttachment
=
function
(
id
,
name
)
{
...
...
test/jio.storage/davstorage.tests.js
View file @
8f5eb06b
...
...
@@ -765,6 +765,29 @@
});
});
test
(
"
putAttachment to inexisting directory: expecting a 404
"
,
function
()
{
var
blob
=
new
Blob
([
"
foo
"
]),
url
=
domain
+
"
/inexistent_dir/attachment1
"
;
this
.
server
.
respondWith
(
"
PUT
"
,
url
,
[
403
,
{
""
:
""
},
""
]);
stop
();
expect
(
3
);
this
.
jio
.
putAttachment
(
"
/inexistent_dir/
"
,
"
attachment1
"
,
blob
)
.
fail
(
function
(
error
)
{
ok
(
error
instanceof
jIO
.
util
.
jIOError
);
equal
(
error
.
message
,
"
Cannot access subdocument
"
);
equal
(
error
.
status_code
,
404
);
})
.
always
(
function
()
{
start
();
});
});
test
(
"
putAttachment document
"
,
function
()
{
var
blob
=
new
Blob
([
"
foo
"
]),
url
=
domain
+
"
/putAttachment1/attachment1
"
,
...
...
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