Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Roque
jio
Commits
663fcc47
Commit
663fcc47
authored
Feb 15, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[linshare] Handle non JSON metadata
parent
f6e18118
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
src/jio.storage/linsharestorage.js
src/jio.storage/linsharestorage.js
+6
-1
test/jio.storage/linsharestorage.tests.js
test/jio.storage/linsharestorage.tests.js
+49
-0
No files found.
src/jio.storage/linsharestorage.js
View file @
663fcc47
...
...
@@ -150,7 +150,12 @@
_linshare_uuid
:
entry_list
[
i
].
uuid
};
if
(
options
.
include_docs
===
true
)
{
entry
.
doc
=
JSON
.
parse
(
entry_list
[
i
].
metaData
)
||
{};
try
{
entry
.
doc
=
JSON
.
parse
(
entry_list
[
i
].
metaData
)
||
{};
}
catch
(
error
)
{
// Metadata are not always JSON
entry
.
doc
=
{};
}
}
result_list
.
push
(
entry
);
...
...
test/jio.storage/linsharestorage.tests.js
View file @
663fcc47
...
...
@@ -294,6 +294,55 @@
});
});
test
(
"
get all documents, include docs and unexpected metadata
"
,
function
()
{
var
search_url
=
domain
+
"
/linshare/webservice/rest/user/v2/documents/
"
,
search_result
=
JSON
.
stringify
([
{
uuid
:
'
uuid1
'
,
name
:
'
foo1
'
,
modificationDate
:
'
2
'
,
metaData
:
'
unexpectedfoo
'
}
]),
server
=
this
.
server
;
this
.
server
.
respondWith
(
"
GET
"
,
search_url
,
[
200
,
{
"
Content-Type
"
:
"
application/json
"
},
search_result
]);
stop
();
expect
(
7
);
this
.
jio
.
allDocs
({
include_docs
:
true
})
.
then
(
function
(
result
)
{
deepEqual
(
result
,
{
data
:
{
rows
:
[{
_linshare_uuid
:
"
uuid1
"
,
id
:
"
foo1
"
,
value
:
{},
doc
:
{}
}],
total_rows
:
1
}
},
"
Check document
"
);
equal
(
server
.
requests
.
length
,
1
);
equal
(
server
.
requests
[
0
].
method
,
"
GET
"
);
equal
(
server
.
requests
[
0
].
url
,
search_url
);
equal
(
server
.
requests
[
0
].
requestBody
,
undefined
);
equal
(
server
.
requests
[
0
].
withCredentials
,
true
);
deepEqual
(
server
.
requests
[
0
].
requestHeaders
,
{
"
Accept
"
:
"
application/json
"
});
})
.
fail
(
function
(
error
)
{
ok
(
false
,
error
);
})
.
always
(
function
()
{
start
();
});
});
test
(
"
get all documents and keep only one doc per name
"
,
function
()
{
var
search_url
=
domain
+
"
/linshare/webservice/rest/user/v2/documents/
"
,
search_result
=
JSON
.
stringify
([
...
...
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