-
Notifications
You must be signed in to change notification settings - Fork 2
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
Lzilioli improvements #7
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR! I left you some comments inline... |
Hi @kaffarell im not seeing comments anywhere (and have no emails about them) can you point me in their direction? |
Hmm weird, try changing to the "Files changed" tab here on github, then you should see them inlined somewhere in the code... |
@kaffarell i don't see any comments or conversations in that view, apologies if i am missing something. |
@@ -151,7 +151,7 @@ export default class TesseractOcrPlugin extends Plugin { | |||
private async getTextFromImage(filePath: string): Promise<string> { | |||
let fullPath = (this.app.vault.adapter as FileSystemAdapter).getFullPath(filePath); | |||
let command = this.settings.tesseractPath + 'tesseract'; | |||
let commandArgs = [fullPath, '-', '-l', this.settings.tesseractLanguage]; | |||
let commandArgs = [`${fullPath.replace(/ /g, '\ ')}`, "-", "-l", this.settings.tesseractLanguage]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to escape the \
here...
Try maybe something more complete like:
replace(/(\s+)/g, '\\$1')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provided code snippet only escapes the first space in a sequence of many. We need to escape each individual space.
"path/to my file has a lot. of spaces".replace(/(\s+)/g, '\\$1')
returns "path/to\\ my\\ file\\ has\\ a\\ lot.\\ of\\ spaces"
Whereas the regex replace in the PR escapes each individual space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, right, this should work:
"path/to my file has a lot. of spaces".replace(/ /g, '\\ ');
Your solution in the PR will just replace the spaces with spaces :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So maybe we just need the double quotes and no replace then? The code as modified fixed the issue I was seeing. I do see that my string ends up unmodified with the replace, so it seems like double quotes may be all thats needed here
Oops, github now requires me explicitly publish my own review :/ |
See #6 (comment)