Skip to content

Commit 9199c64

Browse files
committed
1 parent dca99d6 commit 9199c64

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

files.coffee

+15-2
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,14 @@ class FilesCollection
16591659
binData: evt.data.bin
16601660
chunkId: evt.data.chunkId
16611661

1662+
if @config.isBase64
1663+
pad = opts.binData.length % 4
1664+
if pad
1665+
p = 0
1666+
while p < pad
1667+
opts.binData += '='
1668+
p++
1669+
16621670
@emitEvent 'data', [evt.data.bin]
16631671
if @pipes.length
16641672
for pipeFunc in @pipes
@@ -1819,8 +1827,13 @@ class FilesCollection
18191827
if @config.transport is 'http'
18201828
@config.chunkSize = Math.round @config.chunkSize / 2
18211829

1822-
@config.chunkSize = Math.floor(@config.chunkSize / 8) * 8
1823-
_len = Math.ceil(@fileData.size / @config.chunkSize)
1830+
if @config.isBase64
1831+
@config.chunkSize = Math.floor(@config.chunkSize / 4) * 4
1832+
_len = Math.ceil(@config.file.length / @config.chunkSize)
1833+
else
1834+
@config.chunkSize = Math.floor(@config.chunkSize / 8) * 8
1835+
_len = Math.ceil(@fileData.size / @config.chunkSize)
1836+
18241837
if @config.streams is 'dynamic'
18251838
@config.streams = _.clone _len
18261839
@config.streams = 24 if @config.streams > 24

0 commit comments

Comments
 (0)