Fix rewriting original instance URLs

https://vt.social/@lina/111460117484406174
Regression caused by e231afb49c
This commit is contained in:
blankie 2023-11-30 19:54:35 +11:00
parent 402e74dd6e
commit 42ce457348
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 2 additions and 2 deletions

View File

@ -107,8 +107,8 @@ bool starts_with(const CurlUrl& url, const CurlUrl& base) {
CurlStr url_path = url.get(CURLUPART_PATH);
CurlStr base_path = base.get(CURLUPART_PATH);
size_t base_path_len = strlen(base_path.get());
return memcpy(url_path.get(), base_path.get(), base_path_len) == 0
&& (url_path.get()[base_path_len] == '/' || url_path.get()[base_path_len] == '\0');
return memcmp(url_path.get(), base_path.get(), base_path_len) == 0
&& (base_path.get()[base_path_len - 1] == '/' || url_path.get()[base_path_len] == '/' || url_path.get()[base_path_len] == '\0');
}
std::string get_origin(const httplib::Request& req) {