From 42ce457348bdaddd3b16abe9d1e1f671b08b73ce Mon Sep 17 00:00:00 2001 From: blankie Date: Thu, 30 Nov 2023 19:54:35 +1100 Subject: [PATCH] Fix rewriting original instance URLs https://vt.social/@lina/111460117484406174 Regression caused by e231afb49c05f2074990b474ccfcc00460bc4cd7 --- servehelper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servehelper.cpp b/servehelper.cpp index 1a613b8..1889d71 100644 --- a/servehelper.cpp +++ b/servehelper.cpp @@ -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) {