hedgedoc / cli

A tiny CLI for HedgeDoc
GNU Affero General Public License v3.0
150 stars 37 forks source link

`export` does not work #6

Closed heitorPB closed 5 years ago

heitorPB commented 5 years ago

The import functions works nicely! But the export doesn't. I tried all combinations.

$ env CODIMD_SERVER='https://demo.codimd.org' ./codimd import /tmp/out.md
Found. Redirecting to https://demo.codimd.org/BEy9CA7aTr2blBPAoAXDmg

$ env CODIMD_SERVER='https://demo.codimd.org' ./codimd export --slides BEy9CA7aTr2blBPAoAXDmg out.zip
Cannot specify both -k or --convert-file-only and -O if multiple URLs are given, or in combination
with -p or -r. See the manual for details.

$ env CODIMD_SERVER='https://demo.codimd.org' ./codimd export --html BEy9CA7aTr2blBPAoAXDmg out.html
--2018-09-26 17:01:58--  https://demo.codimd.org/Found.%20Redirecting%20to%20https://demo.codimd.org/s/Bkn2szKYX
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving demo.codimd.org (demo.codimd.org)... 2606:4700:30::681b:92b6, 2606:4700:30::681b:93b6, 104.27.147.182, ...
Connecting to demo.codimd.org (demo.codimd.org)|2606:4700:30::681b:92b6|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-09-26 17:01:58 ERROR 404: Not Found.

Converted links in 0 files in 0 seconds.

There's a typo in codimd:38, it should be ..."$CODIMD_SERVER/$publish_url" right? With the slash? And I removed the -O "$3" option of the wget to make it "work".

B1Sandmann commented 5 years ago

You need to specify a output file to make it work with the -O "$3" then it should work. I proposed a way to fix this in #8 but there are probably nicer ways.

pirate commented 5 years ago

Merged #8 to make this clearer. The output filename must be specified by the user because we cant easily auto-detect the note name to use from the file.

codimd:38 is not a typo, $publish_url contains a slash already, so $CODIMD_SERVER/$publish_url would produce an incorrect url with two slashes.