hedgedoc/cli

CURL-generated cookies.txt file not working to authenticate wget downloads

CptPie opened this issue · 5 comments

Description

I am not sure if it is just a usage error or if it is actually an issue.
After logging in with valid credentials the script prints a success message.
When i then try to download a pad the download results in a html file prompting to login to access the pad.
While testing i noticed that the download only works when the pad is visible for guests which makes me belive that the login functionality is not working correctly or the login state is not tracked.

Executed commands:

env CODIMD_SERVER="{our codimd server}" codimd login --ldap {username} {password}
$ Logged in {our codimd server} as {username} successfully.
env CODIMD_SERVER="{our codimd server}" codimd export --md {pad id} file.md
(file is downloaded but contains html)

Desired state:

The Login Information is carried over to the download function which then downloads the correct data.

Current state:

The Login Information doesn't seem to be carried over and a download (of a restricted pad) results in html.

Steps to Reproduce:

see Executed Commands

Sorry, my bad - I am using the --ldap option - I just forgot to add it to the problem description
I'll edit the original post

Same here.
Figured out curl based options did work (profile, history, ...)
so i tried to replace

wget --load-cookies "$CODIMD_COOKIES_FILE" -O "$exportpath" "$CODIMD_SERVER/$noteid/download"

with

curl -s -b "$CODIMD_COOKIES_FILE" "$CODIMD_SERVER/$noteid/download" -o "$exportpath"

and then things worked.

This is definitely a bug, can you post your (redacted) $CODIMD_COOKIES_FILE here? (it defaults to ~/.codimd-key.conf). In theory cookies.txt should be cross-compatible between curl and wget, but maybe there's some formatting issue or bug making it incompatible with wget.

http://www.cookiecentral.com/faq/#3.5

Fixed in 83d913e

(but not for the slides & html export, so if you find some working wget options still let us know)