mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-14 13:52:01 +02:00
fix(importer-curl): join line continuations that have trailing whitespace (#644)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
eff0c06cb0
commit
ff7eebf3cd
@@ -98,8 +98,12 @@ export const plugin: PluginDefinition = {
|
||||
* Handles line continuations, semicolons, and newline-separated curl commands.
|
||||
*/
|
||||
function splitCommands(rawData: string): string[] {
|
||||
// Join line continuations (backslash-newline, and backslash-CRLF for Windows)
|
||||
const joined = rawData.replace(/\\\r?\n/g, " ");
|
||||
// Join line continuations (backslash-newline, and backslash-CRLF for
|
||||
// Windows). Trailing spaces or tabs after the backslash are common when a
|
||||
// command is copied from a terminal or a doc, and the shell treats
|
||||
// "\ <newline>" as an escaped space rather than a continuation, so accept
|
||||
// them here to keep the pasted command in one piece.
|
||||
const joined = rawData.replace(/\\[ \t]*\r?\n/g, " ");
|
||||
|
||||
// Count consecutive backslashes immediately before position i.
|
||||
// An even count means the quote at i is NOT escaped; odd means it IS escaped.
|
||||
|
||||
Reference in New Issue
Block a user