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

extra character "/" in url for docs|search|recycle-bin api endpoints #3

Open
dvankevich opened this issue Apr 4, 2023 · 1 comment

Comments

@dvankevich
Copy link

My BookStack version v22.11.1

when i run command
./bs_orig search -q time

i got 301 Moved Permanently html response

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://192.168.56.142/api/search?query=time">here</a>.</p>
<hr>
<address>Apache/2.4.52 (Ubuntu) Server at 192.168.56.142 Port 80</address>
</body></html>

the reason is an extra character / in the url

must be http://192.168.56.142/api/search?query=time and there are http://192.168.56.142/api/search/?query=time

my little fix solves this problem

diff bs_orig bs
527,528c527,534
< 
<     "$curl" "${curl_options[@]}" --request GET --url "$url/api/$endpoint${id:+/}$id${target:+/}$target"
---
>     case $endpoint in
>         docs|search|recycle-bin)
>             "$curl" "${curl_options[@]}" --request GET --url "$url/api/$endpoint$id${target:+/}$target"
>             ;;
>         *)
>             "$curl" "${curl_options[@]}" --request GET --url "$url/api/$endpoint${id:+/}$id${target:+/}$target"
>             ;;
>     esac

PinkFreud pushed a commit to PinkFreud/bs that referenced this issue Oct 30, 2024
@PinkFreud
Copy link

I've fixed this in my fork, and created a PR in this repo to have it merged. It looks like this repo might be abandoned, so I'm not holding my breath for it to be applied, but perhaps I'll be surprised.

#6

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

No branches or pull requests

2 participants