Skip to content

Commit

Permalink
[?] Update lsUtil to encode single quotes (as hex).
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Jun 17, 2024
1 parent 0230cad commit c7c48e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/core/src/lsUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "irods/rcGlobalExtern.h"
#include "irods/filesystem.hpp"
#include "irods/irods_query.hpp"
#include "irods/escape_utilities.hpp"

#include <boost/format.hpp>

Expand Down Expand Up @@ -59,8 +60,10 @@ int lsUtil(rcComm_t *conn,
return status;
}

const auto escaped_data_name = irods::single_quotes_to_hex(data_name);
const auto escaped_coll_name = irods::single_quotes_to_hex(coll_name);
const std::string query_str{(boost::format(
"select DATA_ID where DATA_NAME = '%s' and COLL_NAME = '%s'") % data_name % coll_name).str()};
"select DATA_ID where DATA_NAME = '%s' and COLL_NAME = '%s'") % escaped_data_name % escaped_coll_name).str()};
irods::query qobj{conn, query_str};
if (qobj.size() > 0) {
if (const auto id = qobj.front()[0]; !id.empty()) {
Expand Down

0 comments on commit c7c48e2

Please sign in to comment.