blob.read_shift is not a function
yanghoxom opened this issue · 9 comments
When I try to open a xls file
it throws an error
index.js:143 Uncaught (in promise) TypeError: blob.read_shift is not a function
at isEncrypted (index.js:143:1)
Here is my code (file is value of input file type)
const reader = new FileReader();
reader.onload = async e => {
let data = e.target.result;
if (isEncrypted(data)) {
}
};
reader.readAsArrayBuffer(file);
this is my file
Book1.xls
@yanghoxom This problem does exist, thank you
@yanghoxom A new version has been released, just upgrade
@zurmokeeper
sorry for late reply
i tried it a few minutes ago and yeah, I can detect the file has password or not
but it crash on decrypt logic
this is my logic
const reader = new FileReader();
reader.onload = async e => {
let data = e.target.result;
if (isEncrypted(data)) {
data = await decrypt(data, { password });
}
};
reader.readAsArrayBuffer(file);
TypeError: invalid suite type
at Object.createDecipheriv (browser.js:56:1)
at Object.verifyPw [as verifyPassword] (rc4.js:29:1)
at Object.decrypt (xls97.js:492:1)
at decrypt (index.js:74:1)
@yanghoxom Indeed there is this problem, I have found out that the front-end will have problems reading xls,doc,ppt, it should be caused by the front-end encryption and decryption is different from the back-end, I'm still looking at how to solve it.
@yanghoxom A new version has been released, just upgrade
@zurmokeeper
I think logic verify file has password or not is broken for xls
it can not detect file has password. isEncrypted
return false
decrypt
do nothing because it also think this file has no password
test-case-format.xls password 12345678
in my case, filePass
is 134
Book1 (1).xls password 123456
with this file, everything work well
look like we have many formats for xls and format of test-case-format
isn't support right now
I opened it with WPS and found that you have set up two protections, one that requires a password to open and one that is edit protected (you have to output the password again to edit), so maybe the latter is affecting it, maybe that's the problem here? I'm going to take a hard look at it.
@zurmokeeper Yes, you're right, this is a file with a password, but you need to enter the password twice to open it because when setting the password, the creator selected Excel's pass modify
option.
@yanghoxom A new version has been released, just upgrade。Temporarily processed, now can be decrypted, but edit mode after decryption disappeared, here still need to study whether the current processing is reasonable?
A new issue has been opened, welcome to discuss and PR!