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
Hamza
jio
Commits
65abad13
Commit
65abad13
authored
Nov 04, 2015
by
lucas.parsy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
corrected bug preventing to download slice of attachment in indexeddbstorage
added test verifying that the bug is corrected.
parent
9d15334f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
src/jio.storage/indexeddbstorage.js
src/jio.storage/indexeddbstorage.js
+4
-1
test/jio.storage/indexeddbstorage.tests.js
test/jio.storage/indexeddbstorage.tests.js
+32
-0
No files found.
src/jio.storage/indexeddbstorage.js
View file @
65abad13
...
@@ -350,6 +350,7 @@
...
@@ -350,6 +350,7 @@
var
array_buffer_list
=
[],
var
array_buffer_list
=
[],
blob
,
blob
,
i
,
i
,
index
,
len
=
result_list
.
length
;
len
=
result_list
.
length
;
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
array_buffer_list
.
push
(
result_list
[
i
].
blob
);
array_buffer_list
.
push
(
result_list
[
i
].
blob
);
...
@@ -357,8 +358,10 @@
...
@@ -357,8 +358,10 @@
if
((
options
.
start
===
undefined
)
&&
(
options
.
end
===
undefined
))
{
if
((
options
.
start
===
undefined
)
&&
(
options
.
end
===
undefined
))
{
return
new
Blob
(
array_buffer_list
,
{
type
:
type
});
return
new
Blob
(
array_buffer_list
,
{
type
:
type
});
}
}
index
=
Math
.
floor
(
start
/
UNITE
)
*
UNITE
;
blob
=
new
Blob
(
array_buffer_list
,
{
type
:
"
application/octet-stream
"
});
blob
=
new
Blob
(
array_buffer_list
,
{
type
:
"
application/octet-stream
"
});
return
blob
.
slice
(
start
,
end
,
"
application/octet-stream
"
);
return
blob
.
slice
(
start
-
index
,
end
-
index
,
"
application/octet-stream
"
);
});
});
};
};
...
...
test/jio.storage/indexeddbstorage.tests.js
View file @
65abad13
...
@@ -1319,6 +1319,38 @@
...
@@ -1319,6 +1319,38 @@
});
});
});
});
test
(
"
retrieving slice of data
"
,
function
()
{
var
context
=
this
,
attachment
=
"
attachment
"
;
stop
();
expect
(
1
);
deleteIndexedDB
(
context
.
jio
)
.
then
(
function
()
{
return
context
.
jio
.
put
(
"
foo
"
,
{
"
title
"
:
"
bar
"
});
})
.
then
(
function
()
{
return
context
.
jio
.
putAttachment
(
"
foo
"
,
attachment
,
big_string
);
})
.
then
(
function
()
{
return
context
.
jio
.
getAttachment
(
"
foo
"
,
attachment
,
{
"
start
"
:
2000005
,
"
end
"
:
2000015
});
})
.
then
(
function
(
result
)
{
return
jIO
.
util
.
readBlobAsText
(
result
);
})
.
then
(
function
(
result
)
{
var
expected
=
"
aaaaaaaaaa
"
;
equal
(
result
.
target
.
result
,
expected
,
"
Attachment correctly fetched
"
);
})
.
fail
(
function
(
error
)
{
ok
(
false
,
error
);
})
.
always
(
function
()
{
start
();
});
});
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// indexeddbStorage.removeAttachment
// indexeddbStorage.removeAttachment
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
...
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