Skip to content

Conversation

@007harshmahajan
Copy link
Contributor

@007harshmahajan 007harshmahajan commented Oct 22, 2025

User description

resolves #7020

PR Type

Bug fix


Description

  • Fix curl JSON quoting in Curl.vue

Diagram Walkthrough

flowchart LR
  VueComp["Curl.vue component"] -- "generate command" --> CurlCmd["curl with JSON payload"]
  CurlCmd -- "properly escaped" --> Shell["Shell-safe JSON string"]
Loading

File Walkthrough

Relevant files
Bug fix
Curl.vue
Properly escape JSON in curl example                                         

web/src/components/ingestion/logs/Curl.vue

  • Update curl example to use double quotes
  • Escape inner JSON quotes for shell safety
+1/-1     


PR Type

Bug fix


Description

  • Fix curl JSON quoting for Windows

  • Use double-quoted payload with escaped quotes

  • Update Curl.vue ingestion example string


Diagram Walkthrough

flowchart LR
  Vue["Curl.vue ingestion example"] -- "generates" --> Cmd["curl command string"]
  Cmd -- "now Windows-safe" --> JSON["Double-quoted JSON with escapes"]
Loading

File Walkthrough

Relevant files
Bug fix
Curl.vue
Make curl JSON payload Windows-compatible                               

web/src/components/ingestion/logs/Curl.vue

  • Replace single-quoted JSON with double-quoted string
  • Escape inner JSON quotes for Windows compatibility
+1/-1     

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Oct 22, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

PR Reviewer Guide 🔍

(Review updated until commit 7facba3)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

7020 - PR Code Verified

Compliant requirements:

  • Fix the curl command generation so it works correctly on Windows shells.
  • Ensure JSON payload is properly quoted/escaped for Windows environments.
  • Update the Curl.vue component responsible for generating the example ingestion command.

Requires further human verification:

  • Manually test the generated curl command on Windows CMD and PowerShell to confirm it executes successfully.
  • Validate that the command still works on Linux/macOS shells.
⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Cross-shell behavior

Verify the new double-quoted JSON with escaped quotes works across Windows CMD, PowerShell, and common Unix shells; ensure no regression for non-Windows users.

const content = `curl -u [EMAIL]:[PASSCODE] -k ${endpoint.value.url}/api/${store.state.selectedOrganization.identifier}/default/_json -d "[{\\"level\\":\\"info\\",\\"job\\":\\"test\\",\\"log\\":\\"test message for openobserve\\"}]"`;

@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

PR Code Suggestions ✨

Latest suggestions up to 7facba3
Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Quote interpolated URL in curl

Quote the ${endpoint.value.url} interpolation to prevent word-splitting or globbing
if the URL contains special characters. This ensures the curl command remains valid
across URLs with query params or spaces.

web/src/components/ingestion/logs/Curl.vue [55]

-const content = `curl -u [EMAIL]:[PASSCODE] -k ${endpoint.value.url}/api/${store.state.selectedOrganization.identifier}/default/_json -d "[{\"level\":\"info\",\"job\":\"test\",\"log\":\"test message for openobserve\"}]"`;
+const content = `curl -u [EMAIL]:[PASSCODE] -k "${endpoint.value.url}/api/${store.state.selectedOrganization.identifier}/default/_json" -d "[{\\"level\\":\\"info\\",\\"job\\":\\"test\\",\\"log\\":\\"test message for openobserve\\"}]"`;
Suggestion importance[1-10]: 6

__

Why: Quoting the interpolated URL in the curl command improves robustness against spaces or special characters and is consistent with shell best practices; the change is accurate and low-risk but not critical.

Low

Previous suggestions

Suggestions up to commit c73a222
CategorySuggestion                                                                                                                                    Impact
General
Quote the request URL

Quote the URL to prevent shell globbing or word-splitting if it contains special
characters. This avoids unexpected curl failures with endpoints including ?, &, or :
variations.

web/src/components/ingestion/logs/Curl.vue [55]

-const content = `curl -u [EMAIL]:[PASSCODE] -k ${endpoint.value.url}/api/${store.state.selectedOrganization.identifier}/default/_json -d "[{\"level\":\"info\",\"job\":\"test\",\"log\":\"test message for openobserve\"}]"`;
+const content = `curl -u [EMAIL]:[PASSCODE] -k "${endpoint.value.url}/api/${store.state.selectedOrganization.identifier}/default/_json" -d "[{\\"level\\":\\"info\\",\\"job\\":\\"test\\",\\"log\\":\\"test message for openobserve\\"}]"`;
Suggestion importance[1-10]: 7

__

Why: Quoting the interpolated URL in the curl command improves robustness against shell word-splitting and special characters without altering behavior; it's accurate and low-risk.

Medium
Possible issue
Guard against undefined state

If selectedOrganization can be undefined during initial render, string interpolation
will throw. Guard against missing identifier to avoid runtime errors and broken UI.

web/src/components/ingestion/logs/Curl.vue [55]

-const content = `curl -u [EMAIL]:[PASSCODE] -k ${endpoint.value.url}/api/${store.state.selectedOrganization.identifier}/default/_json -d "[{\"level\":\"info\",\"job\":\"test\",\"log\":\"test message for openobserve\"}]"`;
+const orgId = store.state.selectedOrganization?.identifier ?? "default";
+const content = `curl -u [EMAIL]:[PASSCODE] -k ${endpoint.value.url}/api/${orgId}/default/_json -d "[{\\"level\\":\\"info\\",\\"job\\":\\"test\\",\\"log\\":\\"test message for openobserve\\"}]"`;
Suggestion importance[1-10]: 6

__

Why: The guard against a potentially undefined store.state.selectedOrganization is reasonable and can prevent a runtime error, but the PR diff does not indicate such a case explicitly; impact is moderate and context-dependent.

Low

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: 007harshmahajan | Branch: issue-7020 | Commit: 7facba3

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 340 0 19 6 93% 7m 7s

View Detailed Results

@007harshmahajan 007harshmahajan marked this pull request as ready for review October 22, 2025 12:29
@github-actions
Copy link
Contributor

Persistent review updated to latest commit 7facba3

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

Fixed curl command JSON quoting to work on Windows by replacing single quotes with double quotes and escaping inner JSON quotes.

  • Changed -d '[{...}]' to -d "[{\\\"...\\\"}]" in the curl example
  • This ensures the curl command works correctly on Windows cmd.exe, which doesn't handle single quotes as string delimiters
  • The escaped double quotes (\\") in the JavaScript template string produce the correct shell-escaped JSON format

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a simple, well-understood fix that replaces single quotes with properly escaped double quotes in a curl command string, making it compatible with Windows shells while maintaining Unix compatibility
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
web/src/components/ingestion/logs/Curl.vue 5/5 Changed curl command to use double quotes with escaped JSON for Windows compatibility

Sequence Diagram

sequenceDiagram
    participant User
    participant CurlVue as Curl.vue Component
    participant Template as Template String
    participant Shell as User's Shell (Windows/Unix)
    participant API as OpenObserve API
    
    User->>CurlVue: View ingestion instructions
    CurlVue->>Template: Generate curl command with escaped JSON
    Template->>CurlVue: Return command string with double quotes
    CurlVue->>User: Display curl command
    User->>Shell: Execute curl command
    Shell->>API: POST JSON data to /api/org/default/_json
    API->>Shell: Return response
    Shell->>User: Display result
Loading

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: 007harshmahajan | Branch: issue-7020 | Commit: 7facba3

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 344 0 19 2 94% 4m 40s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: nikhilsaikethe | Branch: issue-7020 | Commit: ddaa1fd

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 341 0 19 5 93% 4m 38s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: 007harshmahajan | Branch: issue-7020 | Commit: 9afe232

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 343 0 19 3 94% 4m 38s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: 007harshmahajan | Branch: issue-7020 | Commit: d572067

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 366 343 0 19 4 94% 7m 5s

View Detailed Results

@hengfeiyang hengfeiyang merged commit ac4c301 into main Nov 3, 2025
13 of 15 checks passed
@hengfeiyang hengfeiyang deleted the issue-7020 branch November 3, 2025 04:22
@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: openobserve | Branch: issue-7020 | Commit: 59a988e

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 376 351 0 21 4 93% 4m 31s

View Detailed Results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working Review effort 1/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The curl command for data ingestion does not work for windows

5 participants