From a24331b72a4e2d8615f46210af66b0b517a17d98 Mon Sep 17 00:00:00 2001 From: J-D-K Date: Sat, 13 Sep 2025 23:42:50 -0400 Subject: [PATCH] URL and Form fixes. --- source/remote/Form.cpp | 2 +- source/remote/URL.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/remote/Form.cpp b/source/remote/Form.cpp index 898a3e2..67de1e6 100644 --- a/source/remote/Form.cpp +++ b/source/remote/Form.cpp @@ -10,7 +10,7 @@ remote::Form &remote::Form::append_parameter(std::string_view param, std::string const size_t endLength = m_offset + paramLength + valueLength + 1; if (endLength >= SIZE_FORM_BUFFER) { return *this; } - if (m_offset > 0 && m_formBuffer[m_offset] != '&') { m_formBuffer[m_offset++] = '&'; } + if (m_offset > 0 && m_formBuffer[m_offset - 1] != '&') { m_formBuffer[m_offset++] = '&'; } std::copy(param.begin(), param.end(), &m_formBuffer[m_offset]); m_offset += paramLength; diff --git a/source/remote/URL.cpp b/source/remote/URL.cpp index 37e75d9..b2869dc 100644 --- a/source/remote/URL.cpp +++ b/source/remote/URL.cpp @@ -18,7 +18,7 @@ remote::URL &remote::URL::append_path(std::string_view path) noexcept const size_t pathLength = path.length(); if (m_offset + pathLength >= SIZE_URL_BUFFER) { return *this; } - if (m_urlBuffer[m_offset] != '/' && path.front() != '/') { m_urlBuffer[m_offset++] = '/'; } + if (m_urlBuffer[m_offset - 1] != '/' && path.front() != '/') { m_urlBuffer[m_offset++] = '/'; } std::copy(path.begin(), path.end(), &m_urlBuffer[m_offset]); m_offset += pathLength; @@ -51,7 +51,7 @@ remote::URL &remote::URL::append_parameter(std::string_view param, std::string_v remote::URL &remote::URL::append_slash() noexcept { if (m_offset >= SIZE_URL_BUFFER) { return *this; } - else if (m_urlBuffer[m_offset] != '/') { m_urlBuffer[m_offset++] = '/'; } + else if (m_urlBuffer[m_offset - 1] != '/') { m_urlBuffer[m_offset++] = '/'; } return *this; }