ciur / papermerge

Open Source Document Management System for Digital Archives (Scanned Documents)
https://papermerge.com
Apache License 2.0
2.41k stars 257 forks source link

Additionally installed OCR language is rejected by web UI backend #571

Closed lehnerpat closed 5 months ago

lehnerpat commented 6 months ago

Description After installing an additional OCR language (for example, Japanese) as described in the docs, the additional language can be used in OCR by setting it as the default, but it cannot be used from the web UI because the backend rejects it as an invalid value.

Expected Additionally installed languages should be usable from web UI, just like the default languages.

Actual The additional language shows up in the language selection dropdown for running OCR: CleanShot 2023-12-31 at 17 12 25@2x

But when you click "Start", the backend responds with a 422 error saying the additional language is not an allowed value for the enum.

Additionally, the UI completely ignores this error and doesn't show any error message :(

Full error payload:

{
    "detail": [
        {
            "type": "enum",
            "loc": [
                "body",
                "lang"
            ],
            "msg": "Input should be 'deu','fra','eng','ita','spa','por' or 'ron'",
            "input": "jpn",
            "ctx": {
                "expected": "'deu','fra','eng','ita','spa','por' or 'ron'"
            }
        }
    ]
}

Browser console screenshot: CleanShot 2023-12-31 at 17 12 41@2x

Info:

More info about setup:

ciur commented 6 months ago

Thank you for well structured bug report!

The issue happens because currently the language codes are hardcoded:

  1. in backaned
  2. in UI
  3. and here

The fix would be to, well, just extend current set of hardcoded values with another batch of languages (incl. Japanese).

ciur commented 5 months ago

PR#300 to include extra language codes (incl. Japanese)

Pull request was merged and it will available as part of Papermerge 3.0.1 release.

ciur commented 5 months ago

Fixed in 3.0.2