UB-Mannheim/ocr-fileformat

Download button

zuphilip opened this issue · 6 comments

(Splitted from #60)

Current Behaviour

After uploading a local file and transform it, the download button does nothing.

After choosing an url of a file and transform it, the download button will simply provide a link to that url, which is the input file.

Goal

The goal should be to download the output file. I guess that the button is currently more like a placeholder and the logic behind it is still missing.

Code

I only have found this code for the button:

api.request(tabName, params, formData, function(err, data) {
pane.find("button .spinning").addClass('hidden');
if (err)
return $.notify(err, 'error');
if (url) {
pane.find(".result a.download").attr('href', url);
}
pane.find(".result pre code").html(escapeHTML(data));
pane.find(".result").removeClass('hidden');
Prism.highlightAll()
});
.

Pull request #70 partially implemented the desired functionality. The following use case still does not work for me:

Expected behavior: download of result (ALTO XML)
Observed behavior: download of input (hOCR)

Yes, that is the else case in

} else {
pane.find(".result a.download").attr('href', input.val());
}
. I agree that we don't need this and should just always do what is in the if case.

kba commented

Yup, and change the basename replacement. I'll send a PR.

kba commented

Also needs to make use of Blob/createObjectURL/revokeObjectURL since src attribute will become too large quickly.

It seems that #73 fixed this.

However, the behavior on digi is still different. @stweil Can you check that we have the latest version running?

We do now. Before that, a two years old version was running.