fix race condition in lazy preview loading

remotes/origin/stable6
Jörn Friedrich Dreyer 13 years ago
parent 078bf0df25
commit 98ff847830
  1. 30
      apps/files/js/files.js

@ -628,18 +628,24 @@ function getPathForPreview(name) {
} }
function lazyLoadPreview(path, mime, ready, width, height) { function lazyLoadPreview(path, mime, ready, width, height) {
getMimeIcon(mime,ready); // get mime icon url
if (!width) { getMimeIcon(mime, function(iconURL) {
width = $('#filestable').data('preview-x'); ready(iconURL); // set mimeicon URL
}
if (!height) { // now try getting a preview thumbnail URL
height = $('#filestable').data('preview-y'); if ( ! width ) {
} width = $('#filestable').data('preview-x');
var previewURL = OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:width, y:height}); }
$.get(previewURL, function() { if ( ! height ) {
previewURL = previewURL.replace('(','%28'); height = $('#filestable').data('preview-y');
previewURL = previewURL.replace(')','%29'); }
ready(previewURL + '&reload=true'); var previewURL = OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:width, y:height});
$.get(previewURL, function() {
previewURL = previewURL.replace('(', '%28');
previewURL = previewURL.replace(')', '%29');
//set preview thumbnail URL
ready(previewURL + '&reload=true');
});
}); });
} }

Loading…
Cancel
Save