fix: use l.code instead of l.data for Lang objects in initialize#1052
Open
Oleg-cmd wants to merge 1 commit intonaptha:masterfrom
Open
fix: use l.code instead of l.data for Lang objects in initialize#1052Oleg-cmd wants to merge 1 commit intonaptha:masterfrom
Oleg-cmd wants to merge 1 commit intonaptha:masterfrom
Conversation
When converting Lang objects to string in the initialize function,
the code was incorrectly using l.data (binary content) instead of
l.code (language identifier).
This caused errors like 'Error opening data file ./31,139,8,8...'
when using the Lang object API with custom language data.
Fixes the documented API usage:
createWorker([
'eng',
{ code: 'rus', data: languageFileData }
])
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
src/worker-script/index.jsline 238, theinitializefunction incorrectly usesl.datainstead ofl.codewhen converting Lang objects to a string.Impact
This breaks the documented API for loading custom language data from memory:
Currently results in errors like:
Error opening data file ./31,139,8,8,220,55,243,92...
Failed loading language '31,139,8,8...'
The worker tries to use the binary data content as a filename instead of the code property.