diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-20 07:43:00 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-20 07:43:00 +0800 |
commit | 42236c6df3628a3543cf6013d2952484c6f5c8aa (patch) | |
tree | 5621b743b527e8043309c331e3fb3e11be562d4a | |
parent | 74f237067c8501cbf9b776517d3a702e0050154c (diff) |
This is what actually is correct
-rw-r--r-- | interchange.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/interchange.cxx b/interchange.cxx index 4f8d9e0..6108547 100644 --- a/interchange.cxx +++ b/interchange.cxx @@ -4,14 +4,16 @@ namespace QInterchange { static Interchange* interchange; - static int sampleUrlLength; + static int sampleUrlLength = 0; Interchange::Interchange(const char* sampleURL, const char* image_Dir, const QString& cookie, const QString& certificate) { interchange = this; +#ifndef __EMSCRIPTEN__ auto length = strlen(sampleURL); - sampleUrlLength = length + (sampleURL[length - 1] == '/'); + sampleUrlLength = length + (sampleURL[length - 1] != '/'); +#endif interchange_init(sampleURL, image_Dir, cookie.isEmpty() ? nullptr : cookie.toLatin1().constData(), @@ -29,7 +31,7 @@ namespace QInterchange { interchange_page(path.toLatin1().constData(), [](interchange_response* response) { interchange->emitPage(QString{response->url} - .remove(0, sampleUrlLength + 1), + .remove(0, sampleUrlLength), QString{response->data}); interchange_free_response(response); }); |