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

use pure js hash function for marked code block generation #2185

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

habdelra
Copy link
Contributor

This fixes a bug where the md5 hash function was not running in the Fastboot env of the worker during indexing. we have replaced this with a pure js hash function.

This solves the indexing error:

[worker 109608 priority 0]: Promise rejected TypeError: Cannot read properties of undefined (reading 'encode')
Please report this to https://github.com/markedjs/marked.
    at getUInt8Buffer (/tmp/tmp-109608-FsRSCx8brLfb/assets/chunk.ba6f521a38934cbdb921.js:412524:24)
    at calculate (/tmp/tmp-109608-FsRSCx8brLfb/assets/chunk.ba6f521a38934cbdb921.js:412562:18)
    at md5 (/tmp/tmp-109608-FsRSCx8brLfb/assets/chunk.ba6f521a38934cbdb921.js:412585:10)
    at _Renderer.code (/tmp/tmp-109608-FsRSCx8brLfb/assets/chunk.2a0fc7d9e4a377bfdb0a.js:19687:95)
    at renderer.<computed> [as code] (/tmp/tmp-109608-FsRSCx8brLfb/assets/chunk.ba6f521a38934cbdb921.js:595221:36)
    at _Parser.parse (/tmp/tmp-109608-FsRSCx8brLfb/assets/chunk.ba6f521a38934cbdb921.js:594850:34)
    at parse (/tmp/tmp-109608-FsRSCx8brLfb/assets/chunk.ba6f521a38934cbdb921.js:594804:19)
    at Marked.parse (/tmp/tmp-109608-FsRSCx8brLfb/assets/chunk.ba6f521a38934cbdb921.js:595367:20)
    at Function.marked [as parse] (/tmp/tmp-109608-FsRSCx8brLfb/assets/chunk.ba6f521a38934cbdb921.js:595396:25)
    at markedSync

h/t @IanCal 🙏

@habdelra habdelra marked this pull request as ready for review February 21, 2025 15:16
@habdelra habdelra requested a review from a team February 21, 2025 15:19
Copy link

Host Test Results

    1 files  ±0      1 suites  ±0   23m 22s ⏱️ -22s
773 tests ±0  771 ✔️ ±0  2 💤 ±0  0 ±0 
778 runs  ±0  776 ✔️ ±0  2 💤 ±0  0 ±0 

Results for commit a105d35. ± Comparison against base commit 05d4cb6.

Copy link
Contributor

@IanCal IanCal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm. Not executed but this is a pretty well used hash function, not cryptographically safe but that's not needed here.

@habdelra habdelra merged commit a708be6 into main Feb 24, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants