From 72774ca5a9d5b502f3d35ad65142dfda92e6ce56 Mon Sep 17 00:00:00 2001 From: core software devel Date: Wed, 29 May 2024 14:51:04 +0000 Subject: [PATCH] remove quotation marks from file path, add forks to helth report --- inc/scanoss.h | 2 +- inc/util.h | 2 +- src/health.c | 3 ++- src/report.c | 2 +- src/util.c | 3 ++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/inc/scanoss.h b/inc/scanoss.h index 9c29e89..7caeced 100644 --- a/inc/scanoss.h +++ b/inc/scanoss.h @@ -40,7 +40,7 @@ #define WFP_REC_LN 18 /* Log files */ -#define SCANOSS_VERSION "5.4.5" +#define SCANOSS_VERSION "5.4.6" #define SCAN_LOG "/tmp/scanoss_scan.log" #define MAP_DUMP "/tmp/scanoss_map.dump" #define SLOW_QUERY_LOG "/tmp/scanoss_slow_query.log" diff --git a/inc/util.h b/inc/util.h index 6aa43eb..d803139 100644 --- a/inc/util.h +++ b/inc/util.h @@ -39,7 +39,7 @@ void remove_char(char *str, char chr); bool stristart(char *a, char *b); /* Cleans str from unprintable characters or quotes */ -void string_clean(char *str); +char * string_clean(char *str); /* Calculates crc32c for a string */ uint32_t string_crc32c(char *str); diff --git a/src/health.c b/src/health.c index ed58089..2d53296 100644 --- a/src/health.c +++ b/src/health.c @@ -88,7 +88,8 @@ bool print_health_item(uint8_t *key, uint8_t *subkey, int subkey_ln, uint8_t *da len += sprintf(&result[len],"\"last_update\":\"%s\", ", isalnum(*last_update) ? last_update : " "); len += sprintf(&result[len],"\"last_push\":\"%s\", ", isalnum(*last_push) ? last_push : " "); len += sprintf(&result[len],"\"stars\":%s, ", isdigit(*watchers_count) ? watchers_count : "null"); - len += sprintf(&result[len],"\"issues\":%s} ", isdigit(*issues_count) ? issues_count : "null"); + len += sprintf(&result[len],"\"issues\":%s, ", isdigit(*issues_count) ? issues_count : "null"); + len += sprintf(&result[len],"\"forks\":%s} ", isdigit(*forks_count) ? forks_count : "null"); len += sprintf(&result[len],",\"provenance\":\"%s\"",isalpha(*provenance) ? provenance : " "); match->health_text = strdup(result); diff --git a/src/report.c b/src/report.c index 85c5939..0f3edcb 100644 --- a/src/report.c +++ b/src/report.c @@ -241,7 +241,7 @@ bool print_json_component(component_data_t * component) printf("\"download_url\": \"%s\",", component->url); printf("\"release_date\": \"%s\",", component->release_date); - printf("\"file\": \"%s\",", component->url_match == true ? basename(component->url) : component->file); + printf("\"file\": \"%s\",", component->url_match == true ? basename(component->url) : string_clean(component->file)); if (engine_flags & ENABLE_PATH_HINT) printf("\"path_rank\": %d,", component->path_rank); diff --git a/src/util.c b/src/util.c index a8f87ca..7ed721a 100644 --- a/src/util.c +++ b/src/util.c @@ -167,7 +167,7 @@ void remove_char(char *str, char chr) * @brief Cleans str from unprintable characters or quotes * @param str string to be processed */ -void string_clean(char *str) +char * string_clean(char *str) { char *s = str; while (*s) @@ -178,6 +178,7 @@ void string_clean(char *str) } json_remove_invalid_char(str); + return str; } char * json_remove_invalid_char(char * input)