Skip to content

apiManagerProxy: Fix mtcute wasm URL rewrite for backtick-minified strings#2

Merged
teidesu merged 1 commit into
masterfrom
poli-fix-url-schema-in-electron
Jun 17, 2026
Merged

apiManagerProxy: Fix mtcute wasm URL rewrite for backtick-minified strings#2
teidesu merged 1 commit into
masterfrom
poli-fix-url-schema-in-electron

Conversation

@poli0iq

@poli0iq poli0iq commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

The minifier emits the hashed wasm filename as a backtick template literal, which the absolutize regex did not match, so getWasmUrl ran new URL() against the blob: worker URL and threw, breaking all crypto.

Summary by CodeRabbit

  • Bug Fixes
    • Improved WebAssembly module loading robustness by expanding support for different quote styles in minified code, ensuring absolute module URLs are generated correctly in all scenarios.

…rings

The minifier emits the hashed wasm filename as a backtick template
literal, which the absolutize regex did not match, so getWasmUrl ran new
URL() against the blob: worker URL and threw, breaking all crypto.
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a11154a6-ae6f-46b6-bf1c-4edcc95f9edf

📥 Commits

Reviewing files that changed from the base of the PR and between 8d7c3b3 and 79950a1.

📒 Files selected for processing (1)
  • src/lib/apiManagerProxy.ts

📝 Walkthrough

Walkthrough

In registerThreadedWorker inside apiManagerProxy.ts, the wasm import-path rewrite regex is extended to match mtcute*.wasm filenames delimited by backtick template literal quotes in addition to single and double quotes, and the replacement preserves the matched delimiter.

Changes

Wasm path rewrite regex fix

Layer / File(s) Summary
Regex fix for backtick-quoted wasm paths
src/lib/apiManagerProxy.ts
Adds backtick to the quote character class in the wasm-path rewrite regex and updates the replacement string to capture and re-emit the matched quote, covering minifier output that emits template literals.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A backtick crept in, the regex went blind,
The wasm path vanished, left nothing behind.
🐇 One tweak to the pattern, a quote class aligned,
Now template strings, too, are properly signed!
Hop hop, the WASM loads — right on time. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: fixing WASM URL rewriting to handle backtick-minified strings in apiManagerProxy, which is the core issue described in the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch poli-fix-url-schema-in-electron

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@poli0iq poli0iq requested a review from teidesu June 17, 2026 13:06
@teidesu teidesu merged commit 169cf98 into master Jun 17, 2026
3 checks passed
@poli0iq poli0iq deleted the poli-fix-url-schema-in-electron branch June 17, 2026 14:56
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