Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/image_streamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#endif

#include <iostream>
#include <regex>

namespace web_video_server
{
Expand All @@ -46,7 +47,7 @@ ImageStreamer::ImageStreamer(
async_web_server_cpp::HttpConnectionPtr connection, rclcpp::Node::SharedPtr node)
: request_(request), connection_(connection), node_(node), inactive_(false)
{
topic_ = request.get_query_param_value_or_default("topic", "");
topic_ = std::regex_replace(request.get_query_param_value_or_default("topic", ""), std::regex(R"(%2F)"), "/");
}

ImageStreamer::~ImageStreamer()
Expand Down
3 changes: 2 additions & 1 deletion src/web_video_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <chrono>
#include <vector>
#include <regex>

#include <boost/algorithm/string/predicate.hpp>
#include <opencv2/opencv.hpp>
Expand Down Expand Up @@ -172,7 +173,7 @@ bool WebVideoServer::handle_stream(
{
std::string type = request.get_query_param_value_or_default("type", default_stream_type_);
if (stream_types_.find(type) != stream_types_.end()) {
std::string topic = request.get_query_param_value_or_default("topic", "");
std::string topic = std::regex_replace(request.get_query_param_value_or_default("topic", ""), std::regex(R"(%2F)"), "/");
// Fallback for topics without corresponding compressed topics
if (type == std::string("ros_compressed")) {
std::string compressed_topic_name = topic + "/compressed";
Expand Down
Loading