diff --git a/meshms.c b/meshms.c index 192504c8..928b6699 100644 --- a/meshms.c +++ b/meshms.c @@ -108,6 +108,7 @@ static int get_my_conversation_bundle(const sid_t *my_sidp, rhizome_manifest *m) assert(m->haveSecret); if (m->haveSecret == NEW_BUNDLE_ID) { rhizome_manifest_set_service(m, RHIZOME_SERVICE_FILE); + rhizome_manifest_set_name(m, ""); if (rhizome_fill_manifest(m, NULL, my_sidp) == -1) return WHY("Invalid manifest"); if (config.debug.meshms) { diff --git a/rhizome_bundle.c b/rhizome_bundle.c index 304cdaf6..86906828 100644 --- a/rhizome_bundle.c +++ b/rhizome_bundle.c @@ -1144,18 +1144,20 @@ int rhizome_fill_manifest(rhizome_manifest *m, const char *filepath, const sid_t } if (strcasecmp(RHIZOME_SERVICE_FILE, m->service) == 0) { - if (m->name == NULL) { - if (filepath && *filepath) { - const char *name = strrchr(filepath, '/'); - rhizome_manifest_set_name(m, name ? name + 1 : filepath); - } else - rhizome_manifest_set_name(m, ""); + if (m->name) { if (config.debug.rhizome) - DEBUGF("missing 'name', set default name=%s", alloca_str_toprint(m->name)); - } else { - if (config.debug.rhizome) - DEBUGF("manifest contains name=%s", alloca_str_toprint(m->name)); + DEBUGF("manifest already contains name=%s", alloca_str_toprint(m->name)); + } else if (filepath) { + const char *name = strrchr(filepath, '/'); + if (!name) + name = filepath; + if (rhizome_str_is_manifest_name(name)) + rhizome_manifest_set_name(m, name); + else if (config.debug.rhizome) + DEBUGF("invalid rhizome name %s -- not used", alloca_str_toprint(name)); } + else if (config.debug.rhizome) + DEBUGF("manifest missing 'name'"); } // Anything sent from one person to another should be considered private and encrypted by default.