fix: Encode HTTP headers in patch operations to handle special characters (#30)#48
Open
vanmarkic wants to merge 2 commits intojacksteamdev:mainfrom
Conversation
…ters (jacksteamdev#30) The patch_vault_file and patch_active_file functions were failing with HTTP 400 errors when the Target header contained: - Multi-line text (newlines) - Special characters (accented letters like é, à, etc.) - Special Obsidian syntax (like [[wikilinks]]) This occurred because HTTP headers must be ASCII and cannot contain newlines or certain special characters. The fix applies URL encoding to the Target and Target-Delimiter header values using encodeURIComponent(), which: - Converts newlines and special characters to safe percent-encoded format - Maintains compatibility with standard HTTP header parsing - Allows the Local REST API plugin to properly decode and process the values This resolves the "Header 'Target' has invalid value" errors and allows patch operations to work correctly with complex target strings. Fixes jacksteamdev#30
) - Test encoding of special characters (#, &, ?, =, etc.) - Test encoding of newline and carriage return characters - Test encoding of multi-byte Unicode and emoji characters - Test encoding of path separators (/ and \) - Test encoding of whitespace (spaces, tabs) - Test header construction with encoded target and delimiter - Verify preservation of alphanumeric characters - Verify trimTargetWhitespace boolean to string conversion
✅ Deploy Preview for superb-starlight-b5acb5 canceled.
|
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.
Summary
Changes
Related Issue
Fixes bug #30
🤖 Generated with Claude Code