-
Notifications
You must be signed in to change notification settings - Fork 12
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
Trailing Slash in LT Server URL Causes 400 #449
Comments
The bug doesn't seem to be related to the MD document at all. I can trigger it with a very simple one line document like |
Hey! Thanks for opening an issue, and sorry about the long delay. Was on an extended vacation. I'll take a look as soon as I can. |
@chrillek - I'm unable to recreate the issue with either the Markdown document or "A simple test" in a plain text file. I'm running LT v5.8 via podman locally. Are you still experiencing issues? |
I’m currently not at home. Let me try that in about two weeks time, please.
… Am 21.09.2022 um 07:15 schrieb David L. Day ***@***.***>:
@chrillek - I'm unable to recreate the issue with either the Markdown document or "A simple test" in a plain text file. I'm running LT v5.8 via podman locally.
Are you still experiencing issues?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
Hi, I reinstalled the language tool linter as well as LanguageTool itself. The latter runs in a Docker container on a Synology workstation.
In VSC, I used a very simple test file (similar to yours), and I get the message
Error connecting to http://192.168.44.5:8010//v2/check
FetchError: invalid json response body at http://192.168.44.5:8010//v2/check reason: Unexpected token E in JSON at position 0
in my console. The first one is BS, it is connecting just fine. I checked with Wireshark: There’s a lovely POST request to the host at 192.168.44.5, and the host responds with an HTTP error 400: "Error: This is the LanguageTool API. You have not specified any parameters. Please see https://languagetool.org/http-api/swagger-ui/#/default“
Now, when use the exact same POST data in a curl call like so (sorry, it’s a bit longish because of all the markdown escaping)
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'language=auto&motherTongue=de-DE&data=%7B%22annotation%22%3A%5B%7B%22interpretAs%22%3A%22%22%2C%22markup%22%3A%22%22%2C%22offset%22%3A%7B%22end%22%3A0%2C%22start%22%3A0%7D%7D%2C%7B%22offset%22%3A%7B%22end%22%3A17%2C%22start%22%3A0%7D%2C%22text%22%3A%22Das%20hier%20ist%20nur%20%22%7D%2C%7B%22interpretAs%22%3A%22%22%2C%22markup%22%3A%22_%22%2C%22offset%22%3A%7B%22end%22%3A18%2C%22start%22%3A17%7D%7D%2C%7B%22offset%22%3A%7B%22end%22%3A21%2C%22start%22%3A18%7D%2C%22text%22%3A%22ein%22%7D%2C%7B%22interpretAs%22%3A%22%22%2C%22markup%22%3A%22_%22%2C%22offset%22%3A%7B%22end%22%3A22%2C%22start%22%3A21%7D%7D%2C%7B%22offset%22%3A%7B%22end%22%3A39%2C%22start%22%3A22%7D%2C%22text%22%3A%22%20Testrest%C3%BCmpfumpf%22%7D%2C%7B%22interpretAs%22%3A%22%22%2C%22markup%22%3A%22%22%2C%22offset%22%3A%7B%22end%22%3A39%2C%22start%22%3A39%7D%7D%5D%7D' http://192.168.44.5:8010/v2/check
the response is precisely what I’d expect, no error at all.
Now, I had a closer look at the URL in the console message (see above). There are two consecutive forward slashes : …8010//v2/… because I entered ‚http://192.168.44.5:8010/' in the extension’s URL field.
Removing this trailing slash fixed everything. Which I find a bit weird: AFAIK, two consecutive forward slashes in an URL should not matter a bit. I might be wrong of course. But may be you could either
- warn users against a closing slash after their URL
- or just remove it in the extension if it’s there.
Anyway, I’m happy now. Thanks a lot!
Christian
… Am 21.09.2022 um 14:15 schrieb David L. Day ***@***.***>:
@chrillek - I'm unable to recreate the issue with either the Markdown document or "A simple test" in a plain text file. I'm running LT v5.8 via podman locally.
Are you still experiencing issues?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
Thanks for uncovering this! I'll incorporate something to prevent this from happening to others. |
Describe the bug
The JSON POST request send to the external server causes a 400 error to be sent back
Wireshark-Log
According to Wireshark, the POST data is
language=auto
data={"annotation":[{"interpretAs":"\n\n\n\n","markup":"<link rel=\"stylesheet\" href=\"styles.css\">\n{{TOC}}\n## Why would you care about CSS?\n\n","offset":{"end":84,"start":0}},{"offset":{"end":623,"start":84},"text":"CSS stands for Cascading Style Sheets. It is a text format that allows you to describe the visual appearance of HTML documents. In DEVONthink, CSS is used to determine the visual appearance of Markdown documents when they are rendered as HTML. Whenever you select the preview mode to look at a Markdown document, you'll see it rendered as HTML in some kind of \"style\". Unless you do anything about it, this will be the style that is built into DEVONthink (and the HTML engine it uses). If you're happy with that, you can stop reading here."},{"interpretAs":"\n\n# ","markup":"\n\n## ","offset":{"end":628,"start":623}},{"offset":{"end":676,"start":628},"text":"How can you tell DEVONthink to use your own CSS?"},{"interpretAs":"\n\n","markup":"\n\n","offset":{"end":678,"start":676}},{"offset":{"end":827,"start":678},"text":"As of the time of this writing (DEVONthink Pro Version 3.8 and DEVONthink To Go 3.5.1), there are four methods to specify your own CSS in DEVONthink:"},{"interpretAs":"\n\n** ","markup":"\n\n1. ","offset":{"end":832,"start":827}},{"offset":{"end":1103,"start":832},"text":"In the global preferences. In DEVONthink, you'd provide the x-devonthink-item URL to a record stored somewhere in your database(s) and containing your CSS. In DEVONthink To Go, you do the same in the settings for Markdown documents. A globally defined CSS will influence "},{"interpretAs":"","markup":"_","offset":{"end":1104,"start":1103}},{"offset"
The server returns
Error: This is the LanguageTool API. You have not specified any parameters...
Environment & Configuration (please complete the following information):
Additional context
A simple example on the command line runs ok:
curl -d "language=en-US" -d "text=a simple test" http://192.168.44.5:8010/v2/check {"software":{"name":"LanguageTool","version":"5.7","buildDate":"2022-05-24 19:41:20 +0000","apiVersion":1,"premium":false,"premiumHint":"You might be missing errors only the Premium version can find. Contact us at support<at>languagetoolplus.com.","status":""},"warnings":{"incompleteResults":false},"language":{"name":"English (US)","code":"en-US","detectedLanguage":{"name":"French","code":"fr","confidence":0.815771}},"matches":[{"message":"This sentence does not start with an uppercase letter.","shortMessage":"","replacements":[{"value":"A"}],"offset":0,"length":1,"context":{"text":"a simple test","offset":0,"length":1},"sentence":"a simple test","type":{"typeName":"Other"},"rule":{"id":"UPPERCASE_SENTENCE_START","description":"Checks that a sentence starts with an uppercase letter","issueType":"typographical","category":{"id":"CASING","name":"Capitalization"}},"ignoreForIncompleteSentence":true,"contextForSureMatch":-1}]}
The MD file I used can be found here https://github.com/chrillek/CSS-for-Markdown/blob/master/Using%20CSS.md
The text was updated successfully, but these errors were encountered: