Bug fixing
This commit is contained in:
23
publish.sh
23
publish.sh
@@ -33,6 +33,14 @@ function die() {
|
||||
#--------------------------------
|
||||
cd $SCRIPT_DIR
|
||||
|
||||
# build the executables
|
||||
./build.sh
|
||||
|
||||
# build the Docker image
|
||||
./build-docker.sh
|
||||
|
||||
# push the Docker image to the registry
|
||||
|
||||
if [ ! -f ${EXE_DIR}/simple_object_storage-linux-x86_64 ]; then
|
||||
die "x86_64 executable not found"
|
||||
fi
|
||||
@@ -41,24 +49,19 @@ if [ ! -f ${EXE_DIR}/simple_object_storage-linux-arm64 ]; then
|
||||
die "arm64 executable not found"
|
||||
fi
|
||||
|
||||
# build the executables.
|
||||
./build.sh
|
||||
|
||||
# use Docker architecture style
|
||||
cp ${EXE_DIR}/simple_object_storage-linux-x86_64 ${EXE_DIR}/simple_object_storage-linux-amd64
|
||||
|
||||
echo "amd64 executable: ./simple_object_storage-linux-amd64"
|
||||
echo "arm64 executable: ./simple_object_storage-linux-arm64"
|
||||
|
||||
echo "Setting up Docker BuildX builder 'sosbuilder'"
|
||||
# Check if builder instance exists
|
||||
if ! docker buildx inspect sosbuilder > /dev/null 2>&1; then
|
||||
echo "Builder 'sosbuilder' not found, creating..."
|
||||
docker buildx create --name sosbuilder
|
||||
else
|
||||
echo "Builder 'sosbuilder' already exists."
|
||||
fi
|
||||
# Ensure the builder is used
|
||||
docker buildx use sosbuilder
|
||||
echo "Building multi-platform Docker image"
|
||||
docker buildx build --push -t gitea.jde.nz/public/simple-object-storage:latest --platform linux/amd64,linux/arm64 .
|
||||
|
||||
rm ${EXE_DIR}/simple_object_storage-linux-amd64
|
||||
|
||||
echo "Build completed successfully!"
|
||||
|
||||
|
@@ -185,8 +185,8 @@ bool Database::remove_by_hash(const std::string& hash) {
|
||||
bool Database::get(const std::string& key, dbEntry& entry) {
|
||||
std::string sql;
|
||||
if (key.find(':') != std::string::npos) {
|
||||
// Query by label:tag
|
||||
sql = "SELECT hash, labeltags, metadata FROM objects WHERE labeltags LIKE ?;";
|
||||
// Query by label:tag - search for exact match in the JSON array
|
||||
sql = "SELECT hash, labeltags, metadata FROM objects WHERE json_array_length(labeltags) > 0 AND EXISTS (SELECT 1 FROM json_each(labeltags) WHERE value = ?);";
|
||||
} else {
|
||||
// Query by hash
|
||||
sql = "SELECT hash, labeltags, metadata FROM objects WHERE hash = ?;";
|
||||
@@ -198,9 +198,8 @@ bool Database::get(const std::string& key, dbEntry& entry) {
|
||||
}
|
||||
|
||||
if (key.find(':') != std::string::npos) {
|
||||
// Create JSON array pattern for LIKE query
|
||||
std::string labeltag_pattern = "%\"" + key + "\"%";
|
||||
sqlite3_bind_text(stmt, 1, labeltag_pattern.c_str(), -1, SQLITE_STATIC);
|
||||
// For label:tag queries, bind the exact label:tag string
|
||||
sqlite3_bind_text(stmt, 1, key.c_str(), -1, SQLITE_STATIC);
|
||||
} else {
|
||||
sqlite3_bind_text(stmt, 1, key.c_str(), -1, SQLITE_STATIC);
|
||||
}
|
||||
|
Reference in New Issue
Block a user