Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

414 Request-URI Too Large: Switch to POST if the URI is too long #2

Closed
rumbin opened this issue Oct 21, 2021 · 8 comments
Closed

414 Request-URI Too Large: Switch to POST if the URI is too long #2

rumbin opened this issue Oct 21, 2021 · 8 comments

Comments

@rumbin
Copy link

rumbin commented Oct 21, 2021

Problem Description

When an (excalidraw) drawing is too large (contains too many characters), then the URI becomes too large.
This results in the image not being renderd in MkDocs. Instead, a placeholder image is shown:

image

I suppose that this is caused by the drawing code being too long.
At least that is what https://kroki.io/#try shows when providing a too long excalidraw JSON.

Possible solution:

Switch to POST, either always or only if the URI would become too long.
For reference, see identical issues of other languages and their solutions:

@rumbin
Copy link
Author

rumbin commented Oct 21, 2021

POST is documented here: https://docs.kroki.io/kroki/setup/usage/

@b-bittner
Copy link
Contributor

Thanks for this issue, it is a good idea to use this config parameter. I will try to implement it, but it could take some time. PRs are generally welcome

@oniboni
Copy link
Collaborator

oniboni commented Feb 2, 2022

@rumbin Can you provide some test data to reproduce the issue?

@saheljalal
Copy link

Any complicated or large export from excalidraw.com should work. Facing this as well, would be great if it could be switched to POST.

@b-bittner
Copy link
Contributor

I just looked into this issue, but as far as I can see, there is other basic problem with that.
At the moment, default configuration is to embed the drawings in an html img tag with the URL as source.
It seems so, that Image-Tags in html can only have GET-Requests as source (Am I correct?).

If so, I only see the option to first download the drawing (which is optional at the moment).
So a solution could be:

  • Small enough drawings as GET-URL inside img-tag (to maintain default settings)
  • Warning/Hint when content/URL is too big (and download is disabled - as is in default)
  • Always use POST-Requests when download is enabled - img-tag then uses local-img-url

Feedback please!

@saheljalal
Copy link

saheljalal commented Feb 28, 2022

Not sure I fully understand the image tag reference and I have limited Python knowledge, but looking at the plugin code, it seems that it is using urlretrieve which by default uses GET.

Maybe there is another way to implement this using the standard library by passing in data and making it use POST instead. Also, any reason to not just always use POST?

@oniboni
Copy link
Collaborator

oniboni commented Mar 1, 2022

@b-bittner Yes, you are right. Your solution would work as a quick fix.

I looked into the asciidoc plugin and it seems, that they are doing the request via JS in the browser at a later stage. This may also be an option.

@oniboni oniboni mentioned this issue Mar 1, 2022
@b-bittner
Copy link
Contributor

This issue should now be fixed with #7

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

No branches or pull requests

4 participants