Skip to content

Commit

Permalink
Fix: Extract corrupt file show first error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ollm committed Mar 31, 2024
1 parent cae6b6c commit b95de2c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
2 changes: 2 additions & 0 deletions scripts/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,8 @@ function compressedError(error, showInPage = true)
key: 'compressedError',
text: language.error.uncompress.title+(error ? ': '+(error.detail || error.message) : ''),
duration: 6,
update: true,
updateShown: true,
buttons: [
{
text: language.buttons.dismiss,
Expand Down
12 changes: 8 additions & 4 deletions scripts/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -1046,15 +1046,14 @@ function snackbar(config)

snackbarCurrent = config;

var duration = config.duration;
let duration = config.duration;

if(duration > 10)
duration = 10;
else if(duration < 4)
duration = 4;

handlebarsContext.snackbar = config;

$('.snackbars').html(template.load('snackbar.html'));

snackbarST = setTimeout(function() {
Expand All @@ -1080,7 +1079,7 @@ function snackbar(config)
}
else
{
var isset = false;
let isset = false;

for(let key in snackbarQueue)
{
Expand All @@ -1093,10 +1092,15 @@ function snackbar(config)
}
}

if(!isset && (!snackbarCurrent || (snackbarCurrent.key != config.key || config.update)))
if(!isset && (!snackbarCurrent || (snackbarCurrent.key != config.key || (config.update && !config.updateShown))))
{
snackbarQueue.push(config);
}
else if(!isset && snackbarCurrent.key == config.key && config.updateShown)
{
let snackbarText = document.querySelector('.snackbars .snackbar-text');
if(snackbarText) snackbarText.innerHTML = config.text;
}
}
}

Expand Down
19 changes: 8 additions & 11 deletions scripts/file-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ var file = function(path, _config = false) {
{
if(json.mtime == mtime || _isServer)
{
if(json.error)
if(json.error && !this.config.fromThumbnailsGeneration)
dom.compressedError({message: json.error}, false);

return json.files;
Expand Down Expand Up @@ -1894,12 +1894,10 @@ var fileCompressed = function(path, _realPath = false, forceType = false, prefix

if(readSome)
{
console.timeEnd('read7z: '+_this.path);
/*_this.files = _this.filesToMultidimension(files);
resolve(_this.files);*/

_this.files = _this.filesToMultidimension(files);
resolve(_this.files);

_this.saveErrorToCache(error);
//_this.saveErrorToCache(error);
dom.compressedError(error, false);
}
else
Expand Down Expand Up @@ -1949,17 +1947,16 @@ var fileCompressed = function(path, _realPath = false, forceType = false, prefix

_this.setProgress(1);

console.log('extract7z end:'+_this.path);

resolve();

}).on('error', function(error) {

if(extractedSome)
{
console.timeEnd('extract7z: '+_this.path);

_this.setProgress(1);

resolve();
/*_this.setProgress(1);
resolve();*/

_this.saveErrorToCache(error);
dom.compressedError(error, false);
Expand Down

0 comments on commit b95de2c

Please sign in to comment.