Markdown output loses backslashes before pipes and splits rows on carriage returns

Đang mở Phù hợp với người mới
#2,735 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu với runner.Result.MarkdownRow và phần triển khai escapeMarkdown được đề cập trong issue; bản tái hiện Go được cung cấp kiểm tra cả hai trường hợp mà không cần yêu cầu HTTP. Kiểm tra cách xử lý dấu gạch chéo ngược và LF, sau đó chạy bản tái hiện và hiển thị đầu ra dưới dạng bảng Markdown của GitHub. Hoàn tất khi dấu gạch chéo ngược theo nghĩa đen được giữ nguyên và CR, CRLF, LF bên trong ô không còn chia một kết quả thành các hàng thừa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Type: Bug
httpx version:

Current dev, 9b6d8077ef7afa119dd6d28eeaf78a6556557acc (Linux amd64, Go 1.27.0). The same escapeMarkdown implementation is in v1.12.0.

Current Behavior:

Markdown output loses literal backslashes before a pipe. A carriage return inside a field can also split one result into two table rows.

For example, a response with title left\|right and <meta name="generator" content="left&#13;right"> produces a title cell with two backslashes before the pipe and leaves the generator's carriage return intact. GitHub's Markdown renderer displays the title as left|right and makes an extra row at the carriage return. Later columns no longer line up with their headings.

Expected Behavior:

Keep the literal backslash in the title and flatten CR/CRLF as well as LF inside table cells, so each result stays on one row.

Steps To Reproduce:

This reproduces the output formatting without making any HTTP requests. From a checkout of current dev, save this as /tmp/httpx-markdown-repro.go and run go run /tmp/httpx-markdown-repro.go:

package main

import (
    "fmt"
    "github.com/projectdiscovery/httpx/runner"
)

func main() {
    r := runner.Result{
        Title: "left\\|right",
        Generator: "left\rright",
        StatusCode: 200,
    }
    fmt.Print(r.MarkdownHeader(), r.MarkdownRow(nil))
}

Render the output as a GitHub Markdown table. The title loses its backslash, and the generator value starts a second row.

Anything else:

I also reproduced this through the CLI against a loopback-only Python HTTP server serving the two fields. Escaping existing backslashes and normalizing CRLF/CR before writing the cell fixes both cases locally. No external targets are needed.

Ngôn ngữ chính
Go
Star
10.6k
Fork
1.1k
Merge trung bình
22 giờ 16 phút
Pull request đã merge (30 ngày)
24

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của projectdiscovery/httpx

Tất cả issue của projectdiscovery/httpx

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.