fix race condition in lazy preview loading

This commit is contained in:
Jörn Friedrich Dreyer 2013-09-19 14:46:33 +02:00
parent 078bf0df25
commit 98ff847830

View file

@ -628,7 +628,11 @@ function getPathForPreview(name) {
}
function lazyLoadPreview(path, mime, ready, width, height) {
getMimeIcon(mime,ready);
// get mime icon url
getMimeIcon(mime, function(iconURL) {
ready(iconURL); // set mimeicon URL
// now try getting a preview thumbnail URL
if ( ! width ) {
width = $('#filestable').data('preview-x');
}
@ -639,8 +643,10 @@ function lazyLoadPreview(path, mime, ready, width, height) {
$.get(previewURL, function() {
previewURL = previewURL.replace('(', '%28');
previewURL = previewURL.replace(')', '%29');
//set preview thumbnail URL
ready(previewURL + '&reload=true');
});
});
}
function getUniqueName(name){