Skip to content

Commit

Permalink
[coro_http] fix client upload file which filename is string_view
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Jul 3, 2024
1 parent 91197b7 commit 4cd7b82
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)
project(yaLanTingLibs
VERSION 0.3.2
VERSION 0.3.4
DESCRIPTION "yaLanTingLibs"
HOMEPAGE_URL "https://github.com/alibaba/yalantinglibs"
LANGUAGES CXX
Expand Down
4 changes: 2 additions & 2 deletions include/ylt/coro_io/coro_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,10 @@ class coro_file {
return fseek(stream_file_.get(), offset, whence) == 0;
}

async_simple::coro::Lazy<bool> async_open(std::string filepath,
async_simple::coro::Lazy<bool> async_open(std::string_view filepath,
int open_mode = flags::read_write,
read_type type = read_type::fread) {
file_path_ = std::move(filepath);
file_path_ = std::string{filepath};
type_ = type;
if (type_ == read_type::pread) {
co_return open_fd(file_path_, open_mode);
Expand Down
4 changes: 2 additions & 2 deletions include/ylt/standalone/cinatra/coro_http_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {

private:
async_simple::coro::Lazy<void> send_file_chunked_with_copy(
std::string source, std::error_code &ec) {
std::string_view source, std::error_code &ec) {
std::string file_data;
detail::resize(file_data, max_single_part_size_);
coro_io::coro_file file{};
Expand All @@ -873,7 +873,7 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
}

async_simple::coro::Lazy<void> send_file_no_chunked_with_copy(
std::string source, std::error_code &ec, std::size_t length) {
std::string_view source, std::error_code &ec, std::size_t length) {
if (length <= 0) {
co_return;
}
Expand Down

0 comments on commit 4cd7b82

Please sign in to comment.