Skip to content

Commit

Permalink
ATARI: Improve trailing slash in sio_set_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsternberg authored and tschak909 committed Oct 6, 2024
1 parent af75c13 commit 3ee6db5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/device/sio/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,13 @@ void sioNetwork::sio_set_prefix()

prefixSpec_str = string((const char *)prefixSpec);
prefixSpec_str = prefixSpec_str.substr(prefixSpec_str.find_first_of(":") + 1);

// Append trailing slash if not found
if (prefixSpec_str.back() != '/')
{
prefixSpec_str += "/";
}

#ifdef VERBOSE_PROTOCOL
Debug_printf("sioNetwork::sio_set_prefix(%s)\n", prefixSpec_str.c_str());
#endif
Expand All @@ -568,7 +575,7 @@ void sioNetwork::sio_set_prefix()
else
{
// For the remaining cases, append trailing slash if not found
if (prefix[prefix.size()-1] != '/')
if (prefix.back() != '/')
{
prefix += "/";
}
Expand Down Expand Up @@ -600,11 +607,6 @@ void sioNetwork::sio_set_prefix()
else if (prefixSpec_str.find_first_of(":") != string::npos)
{
prefix = prefixSpec_str;
// Check for trailing slash. Append if missing.
if (prefix[prefix.size()-1] != '/')
{
prefix += "/";
}
}
else // append to path.
{
Expand Down

0 comments on commit 3ee6db5

Please sign in to comment.