Skip to content

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

@dvankevich

Description

@dvankevich

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions