From cce6e32b6199dd8f8970a5ac55eb94d4e53829ae Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 7 Feb 2021 19:01:04 +0800 Subject: [PATCH] fix: got a wrong link after guest uploaded in Aliyundrive --- theme/classic.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/theme/classic.html b/theme/classic.html index 4b40b94..501e9e8 100644 --- a/theme/classic.html +++ b/theme/classic.html @@ -855,7 +855,7 @@ uploadbuttonshow(); return; } - upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name)); + var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name)); var filemd5=''; function getext(str) { @@ -1085,12 +1085,22 @@ uploadbuttonshow(); return; }*/ - upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name)); + var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name)); td2.innerHTML='计算SHA1 ...'; var reader = new FileReader(); reader.readAsArrayBuffer(file); reader.onload = function(e) { var filesha1 = sha1(this.result); + + 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; + td2.innerHTML=' ...'; var html = JSON.parse(localStorage.getItem(filesha1)); //console.log(html);