Skip to content

Commit

Permalink
Merge pull request #757 from Chenhw2017/hotfix/fix-Uint16Array-RangeE…
Browse files Browse the repository at this point in the history
…rror

fix: 传给Uint16Array的buffer字节大小必须是2的整数倍
  • Loading branch information
xyxiao001 authored Sep 7, 2023
2 parents 8cfac5c + a6f8ca6 commit bdbdd54
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/exif-js-min.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ function base64ToArrayBuffer(base64, contentType) {
contentType = contentType || base64.match(/^data\:([^\;]+)\;base64,/mi)[1] || ''; // e.g. 'data:image/jpeg;base64,...' => 'image/jpeg'
base64 = base64.replace(/^data\:([^\;]+)\;base64,/gmi, '');
var binary = atob(base64);
var len = binary.length;
// byte length of Uint16Array should be a multiple of 2
var len = binary.length % 2 == 0 ? binary.length : binary.length + 1;
var buffer = new ArrayBuffer(len);
var view = new Uint16Array(buffer);
for (var i = 0; i < len; i++) {
Expand Down

1 comment on commit bdbdd54

@vercel
Copy link

@vercel vercel bot commented on bdbdd54 Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vue-cropper – ./

vue-cropper-463618622.vercel.app
vue-cropper-git-main-463618622.vercel.app

Please sign in to comment.