Skip to content

Commit

Permalink
#158 Fix a bug that calculates the size of files incorrectly when imp…
Browse files Browse the repository at this point in the history
…orting through Dropbox/OneDrive

Close #158
  • Loading branch information
Rafael committed Nov 11, 2017
1 parent 1100c77 commit 333e232
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Extension/esgst.js
Original file line number Diff line number Diff line change
Expand Up @@ -31944,10 +31944,8 @@ function checkDropboxComplete(data, dm, callback) {
let entries = insertHtml(popup.scrollable, `beforeEnd`, `<div class="popup__keys__list"></div>`);
JSON.parse(response.responseText).entries.forEach(entry => {
if (entry[`.tag`] === `file` && entry.name.match(/esgst_data_.*?\.json/)) {
let size = entry.size / 1048576;
size = size < 1 ? `${Math.round(entry.size * 100) / 100} KB` : `${Math.round(size * 100) / 100} MB`;
let item = insertHtml(entries, `beforeEnd`, `
<div class="esgst-clickable">${entry.name} - ${size}</div>
<div class="esgst-clickable">${entry.name} - ${convertBytes(entry.size)}</div>
`);
item.addEventListener(`click`, () => {
createConfirmation(`Are you sure you want to import the selected data?`, () => {
Expand Down Expand Up @@ -32036,10 +32034,8 @@ function checkOneDriveComplete(data, dm, callback) {
let entries = insertHtml(popup.scrollable, `beforeEnd`, `<div class="popup__keys__list"></div>`);
JSON.parse(response.responseText).value.forEach(file => {
if (file.name.match(/esgst_data_.*?\.json/)) {
let size = file.size / 1048576;
size = size < 1 ? `${Math.round(file.size * 100) / 100} KB` : `${Math.round(size * 100) / 100} MB`;
let item = insertHtml(entries, `beforeEnd`, `
<div class="esgst-clickable">${file.name.replace(/__/g, `:`)} - ${size}</div>
<div class="esgst-clickable">${file.name.replace(/__/g, `:`)} - ${convertBytes(file.size)}</div>
`);
item.addEventListener(`click`, () => {
createConfirmation(`Are you sure you want to import the selected data?`, () => {
Expand Down

0 comments on commit 333e232

Please sign in to comment.