pymdown-extensions icon indicating copy to clipboard operation
pymdown-extensions copied to clipboard

Download snippet + server reply without content-length

Open maartenbreddels opened this issue 7 months ago • 0 comments

Description

Hi,

When I use:

        --8<-- "http://localhost:3001/files/maartenbreddels/test/app.py"

But my server replies with:

$ curl -I http://localhost:3001/files/maartenbreddels/test/app.py
HTTP/1.1 200 OK
cache-control: public, max-age=0, must-revalidate
server: Vercel
x-vercel-id: dev1::qcjlo-1720123058986-b8c5fdc87ba8
x-vercel-cache: MISS
vary: RSC, Next-Router-State-Tree, Next-Router-Prefetch, Accept-Encoding
content-type: text/plain
date: Thu, 04 Jul 2024 19:57:39 GMT
keep-alive: timeout=5
connection: close

(i.e. no content-length - which is also possible with transfer-encoding: chunked)

This extension raises the error:

                raise ValueError("Missing content-length header")

A possible solution could be not to do the check when url_max_size==0.

Let me know what you think.

Regards,

Maarten

Minimal Reproduction

I cannot find a public server that does this, so difficult to give you reproducible steps now

Version(s) & System Info

markdown-it-py 3.0.0

maartenbreddels avatar Jul 04 '24 20:07 maartenbreddels