Conversation
📝 WalkthroughWalkthroughThe change extracts base64 encoding logic into a dedicated private helper function Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Poem
Pre-merge checks✅ Passed checks (1 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
resources/js/services/search-service.ts (1)
29-34: Implementation is correct; consider optional performance improvement.The UTF-8 encoding approach correctly handles Unicode characters. For typical search terms, the current implementation is fine.
If you'd like to optimize for longer strings, consider this alternative:
function base64encode(str: string): string { const bytes = new TextEncoder().encode(str); - let binary = ""; - bytes.forEach((b) => (binary += String.fromCharCode(b))); - return btoa(binary); + return btoa(String.fromCharCode(...bytes)); }Or for better compatibility with very long strings:
function base64encode(str: string): string { const bytes = new TextEncoder().encode(str); - let binary = ""; - bytes.forEach((b) => (binary += String.fromCharCode(b))); - return btoa(binary); + return btoa(Array.from(bytes, (byte) => String.fromCharCode(byte)).join("")); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
resources/js/services/search-service.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: ildyria
Repo: LycheeOrg/Lychee PR: 3641
File: lang/no/settings.php:9-9
Timestamp: 2025-08-22T06:11:18.329Z
Learning: For lang/* translation files in the Lychee project: only review PHP-related issues (syntax, structure, etc.), not translation content, grammar, or language-related nitpicks. The maintainer ildyria has explicitly requested this approach.
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
- GitHub Check: 3️⃣ PHP dist / 8.3 - sqlite
- GitHub Check: 3️⃣ PHP dist / 8.4 - mariadb
- GitHub Check: 3️⃣ PHP dist / 8.4 - sqlite
- GitHub Check: 3️⃣ PHP dist / 8.3 - postgresql
- GitHub Check: 3️⃣ PHP dist / 8.4 - postgresql
- GitHub Check: 3️⃣ PHP dist / 8.3 - mariadb
- GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Unit
- GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Install
- GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Webshop
- GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Webshop
- GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Webshop
- GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Unit
- GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Unit
🔇 Additional comments (2)
resources/js/services/search-service.ts (2)
23-23: LGTM! Correctly fixes Unicode handling.The change from
btoa(terms)tobase64encode(terms)properly addresses the limitation ofbtoa()with Unicode characters like Polish diacritics.
29-34: Verify otherbtoa()usages in application source code—concern is valid.Your review correctly identifies a real issue:
btoa()throwsInvalidCharacterErrorwhen given Unicode characters outside Latin-1 (0x00–0xFF). The fix shown in search-service.ts—using TextEncoder to encode to UTF-8 bytes, then converting to a binary string before calling btoa()—is the correct and preferred modern approach.However, the search script output provided shows only vendor code (minified Vue.js library). To complete verification, ensure the search covers all application source files to identify any other
btoa()usages. The vendor code should not be modified. Anybtoa()calls in your application code should either already handle Unicode safely or be updated with the same TextEncoder pattern.
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit