UB-Mannheim / ocr-fileformat

Validate and transform various OCR file formats (hOCR, ALTO, PAGE, FineReader)
https://digi.bib.uni-mannheim.de/ocr-fileformat/
MIT License
176 stars 23 forks source link

loop of files downloading #93

Closed yanirmr closed 4 years ago

yanirmr commented 5 years ago

when I'm working with the web application I'm having the next problem:

  1. converting the first file and downloading this file - OK
  2. converting the second file and downloading this file - twice automatically.
  3. converting the third file and downloading this file - thrice automatically. etc...

the counter of the loop reset when refreshing. any solution for this bug here would be great.

zuphilip commented 5 years ago

Yes, that is a bug.

You can reload the page (maybe with CTRL+F5) before you convert your next file to work at the moment around this.

The problem seems to be that after each new transformation/validation the submit function is called, which will then add a new event to this download button https://github.com/UB-Mannheim/ocr-fileformat/blob/f9e0099543db10cbda216b66115d7e4b05671821/web/ocr-fileformat.js#L95 . Therefore after transforming three files, there are three events for downloading the resulting files present.

We should either delete all events before adding a new one or actually better might be to move this part out to a better place, such that it will be called only once in the beginning. @kba Would the lines at the end of this file be suitable, i.e. are they only executed once when loading the page?