Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecognize valid urls in worker options #558

Closed
lqt93 opened this issue Aug 2, 2021 · 3 comments
Closed

Unrecognize valid urls in worker options #558

lqt93 opened this issue Aug 2, 2021 · 3 comments
Labels
Dependency Bug Valid bug where fixing is outside the scope of this repo

Comments

@lqt93
Copy link

lqt93 commented Aug 2, 2021

Describe the bug
When I assigned these below valid urls to paths in worker options, tesseract.js did not recognize them:

To Reproduce
Steps to reproduce the behavior:

  1. Assign url
import { createWorker } from "tesseract.js";
const url = "http://someserver/abc";
createWorker({
  langPath: url
})
  1. Throw error

Expected behavior
Works like when assigning other valid urls.

Screenshots
Screen Shot 2021-08-02 at 11 34 07

Desktop (please complete the following information):

  • Browser: Chrome

Additional context

  • I believe the problem is caused due to "is-url" library does not regcognize these urls as valid.
@Balearica
Copy link
Collaborator

Thanks for raising. I see that you've also opened a Git Issue for the is-url library. As I don't think doing our own URL validation is within the scope of this project, I don't think there's anything actionable here until (1) the is_url package is updated or (2) somebody can suggest a more reliable package we can use instead.

@Balearica Balearica added the Dependency Bug Valid bug where fixing is outside the scope of this repo label Sep 17, 2022
@Balearica
Copy link
Collaborator

I recently encountered this issue myself, and now believe it can be solved within Tesseract.js by cutting is-url from the browser version entirely.

The is-url dependency only makes sense in the context of Node.js. For Node, a user may specify a string that is either (1) a URL or (2) a local path. As these are not separate arguments, Tesseract.js needs to figure out which one it was provided, which it uses the is-url package to do. However, in a browser we do not have local file access--any path provided by a user must be a URL.

@Balearica
Copy link
Collaborator

Closing as this should be resolved in the v4.1.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependency Bug Valid bug where fixing is outside the scope of this repo
Projects
None yet
Development

No branches or pull requests

2 participants