diff --git a/lib/app_ipc.cpp b/lib/app_ipc.cpp index 3e77338edc..6e5b46f36a 100644 --- a/lib/app_ipc.cpp +++ b/lib/app_ipc.cpp @@ -27,7 +27,6 @@ #include "filesys.h" #include "miofile.h" #include "parse.h" -#include "str_replace.h" #include "str_util.h" #include "url.h" #include "util.h" diff --git a/lib/str_util.h b/lib/str_util.h index 008e1862ac..4777230d73 100644 --- a/lib/str_util.h +++ b/lib/str_util.h @@ -22,6 +22,8 @@ #include #include +#include "str_replace.h" + #define safe_strcpy(x, y) strlcpy(x, y, sizeof(x)) #define safe_strcat(x, y) strlcat(x, y, sizeof(x)) diff --git a/lib/url.cpp b/lib/url.cpp index cb7c76b255..6ab7045215 100644 --- a/lib/url.cpp +++ b/lib/url.cpp @@ -174,8 +174,10 @@ void escape_url(string& url) { url = buf; } -// Escape a URL for the project directory, cutting off the "http://", +// Escape a project URL, cutting off the "http://", // converting everthing other than alphanumbers, ., - and _ to "_". +// This is used as the project directory name. +// Note: does not convert to lowercase. // void escape_url_readable(char *in, char* out) { int x, y; diff --git a/lib/util.cpp b/lib/util.cpp index 55413de728..b3207604eb 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -17,7 +17,6 @@ #if defined(_WIN32) #include "boinc_win.h" -#include "str_replace.h" #include "str_util.h" #include "win_util.h" #endif @@ -798,16 +797,32 @@ int DOCKER_CONN::parse_container_name(string line, string &name) { string docker_image_name( const char* proj_url_esc, const char* wu_name ) { - char buf[1024]; - sprintf(buf, "boinc__%s__%s", proj_url_esc, wu_name); + char buf[1024], url_buf[1024], wu_buf[1024];; + + // Docker image names can't have upper case chars + // + safe_strcpy(url_buf, proj_url_esc); + downcase_string(url_buf); + safe_strcpy(wu_buf, wu_name); + downcase_string(wu_buf); + + sprintf(buf, "boinc__%s__%s", url_buf, wu_buf); return string(buf); } string docker_container_name( const char* proj_url_esc, const char* result_name ){ - char buf[1024]; - sprintf(buf, "boinc__%s__%s", proj_url_esc, result_name); + char buf[1024], url_buf[1024], result_buf[1024];; + + // Docker image names can't have upper case chars + // + safe_strcpy(url_buf, proj_url_esc); + downcase_string(url_buf); + safe_strcpy(result_buf, result_name); + downcase_string(result_buf); + + sprintf(buf, "boinc__%s__%s", url_buf, result_buf); return string(buf); }