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

Abierto Apto para principiantes
#2,735 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go
Área
cli

Línea de trabajo

Empieza con runner.Result.MarkdownRow y la implementación de escapeMarkdown mencionada en el issue; la reproducción de Go proporcionada prueba ambos casos sin solicitudes HTTP. Comprueba cómo se manejan las barras invertidas y LF, luego ejecuta la reproducción y renderiza su salida como una tabla Markdown de GitHub. Se considerará terminado cuando se conserve la barra invertida literal y CR, CRLF y LF dentro de las celdas ya no dividan un resultado en filas adicionales.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Go
Estrellas
10.6k
Forks
1.1k
Merge medio
22 h 16 min
PR fusionados (30 d)
24

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de projectdiscovery/httpx

Todos los issues de projectdiscovery/httpx

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.