Skip to content

remove quotation marks from file path, add forks to health report #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2024
Merged
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
2 changes: 1 addition & 1 deletion inc/scanoss.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion inc/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/health.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/report.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -178,6 +178,7 @@ void string_clean(char *str)
}

json_remove_invalid_char(str);
return str;
}

char * json_remove_invalid_char(char * input)
Expand Down
Loading