SyncTERM 1.9: don't build a cache path out of characters a path cannot hold A connection made from a URL is named after the URL -- "ssh://host:5522". get_cache_fn_base() puts that name straight into a directory path, so on Windows mkpath() fails, so it returns 0, so apc_handler() gives up before every verb: no VER, no Q;JXL, no cache store, no draw. The symptom is a black screen while the pictures are arriving perfectly well. Replace the characters a path cannot hold (: / \ * ? " < > |) with '_', keep the rest of the name. Identical to the master patch -- it applies to 1.9 unchanged. --- a/src/syncterm/term.c +++ b/src/syncterm/term.c @@ -3521,11 +3521,28 @@ int get_cache_fn_base(struct bbslist *bbs, char *fn, size_t fnsz) { + char safe[MAX_PATH + 1]; + size_t si; + get_syncterm_filename(fn, fnsz, SYNCTERM_PATH_CACHE, false); backslash(fn); if (strlen(fn) + strlen(bbs->name) >= fnsz) return 0; - strcat(fn, bbs->name); + /* The cache directory is named after the connection, and a connection + * made from a URL is named after the URL -- "ssh://host:5522". A colon + * or a slash cannot be a directory name on Windows, so mkpath fails, so + * this returns 0, so apc_handler returns before every verb: no VER, no + * Q;JXL, no store, no draw. A black screen with the pictures arriving + * perfectly well. Keep the name, minus what a path cannot hold. */ + for (si = 0; si < sizeof(safe) - 1 && bbs->name[si]; si++) { + char c = bbs->name[si]; + safe[si] = (c == ':' || c == '/' || c == '\\' || c == '*' || c == '?' + || c == '"' || c == '<' || c == '>' || c == '|') ? '_' : c; + } + safe[si] = 0; + if (strlen(fn) + strlen(safe) >= fnsz) + return 0; + strcat(fn, safe); backslash(fn); if (!isdir(fn)) { if (mkpath(fn))