fix: got a wrong link after guest uploaded in Aliyundrive

pull/217/head
qkqpttgf 2021-02-07 19:01:04 +08:00 committed by GitHub
parent 2b5bb6d3b5
commit cce6e32b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -855,7 +855,7 @@
uploadbuttonshow(); uploadbuttonshow();
return; return;
} }
upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name)); var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
var filemd5=''; var filemd5='';
<!--GuestStart--> <!--GuestStart-->
function getext(str) { function getext(str) {
@ -1085,12 +1085,22 @@
uploadbuttonshow(); uploadbuttonshow();
return; return;
}*/ }*/
upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name)); var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
td2.innerHTML='计算SHA1 ...'; td2.innerHTML='计算SHA1 ...';
var reader = new FileReader(); var reader = new FileReader();
reader.readAsArrayBuffer(file); reader.readAsArrayBuffer(file);
reader.onload = function(e) { reader.onload = function(e) {
var filesha1 = sha1(this.result); var filesha1 = sha1(this.result);
<!--GuestStart-->
function getext(str) {
let p = str.lastIndexOf('.');
if (p===-1) return '';
if (p===0) return '';
return str.substr(p);
}
var ext = getext(file.webkitRelativePath||file.name);
upbigfilename = filesha1 + ext;
<!--GuestEnd-->
td2.innerHTML='<!--constStr@GetUploadLink--> ...'; td2.innerHTML='<!--constStr@GetUploadLink--> ...';
var html = JSON.parse(localStorage.getItem(filesha1)); var html = JSON.parse(localStorage.getItem(filesha1));
//console.log(html); //console.log(html);