diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-02-03 21:55:39 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-02-03 21:55:39 +0000 |
commit | c01d47895c3554598404ca02d8d8f1145290f27e (patch) | |
tree | baec65ec5f7b0ffbaacea6187849393302a7ffdb /src/fs | |
parent | aedc2e507b7b5894b08da7d9b428ff678fff0e99 (diff) |
-also user gnunet-original filename here more consistently
git-svn-id: https://gnunet.org/svn/gnunet@19675 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/fs_dirmetascan.c | 10 | ||||
-rw-r--r-- | src/fs/fs_uri.c | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c index 543701ca25..34170a8d4d 100644 --- a/src/fs/fs_dirmetascan.c +++ b/src/fs/fs_dirmetascan.c @@ -194,6 +194,7 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent, int is_directory) { struct GNUNET_FS_ShareTreeItem *chld; + size_t slen; chld = GNUNET_malloc (sizeof (struct GNUNET_FS_ShareTreeItem)); chld->parent = parent; @@ -202,6 +203,12 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent, "%s%s", GNUNET_STRINGS_get_short_name (filename), is_directory ? "/" : ""); + /* make sure we do not end with '//' */ + slen = strlen (chld->short_filename); + if ( (slen >= 2) && + (chld->short_filename[slen-1] == '/') && + (chld->short_filename[slen-2] == '/') ) + chld->short_filename[slen-1] = '\0'; chld->is_directory = is_directory; if (NULL != parent) GNUNET_CONTAINER_DLL_insert (parent->children_head, @@ -360,8 +367,9 @@ process_helper_msgs (void *cls, GNUNET_CONTAINER_meta_data_delete (ds->pos->meta, EXTRACTOR_METATYPE_FILENAME, NULL, 0); + /* instead, put in our 'safer' original filename */ GNUNET_CONTAINER_meta_data_insert (ds->pos->meta, "<libgnunetfs>", - EXTRACTOR_METATYPE_FILENAME, + EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME, EXTRACTOR_METAFORMAT_UTF8, "text/plain", ds->pos->short_filename, strlen (ds->pos->short_filename) + 1); diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index fac478d385..50c8785b66 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c @@ -1805,7 +1805,7 @@ GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData if (ent > 0) { full_name = GNUNET_CONTAINER_meta_data_get_first_by_types (md, - EXTRACTOR_METATYPE_FILENAME, -1); + EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME, -1); if (NULL != full_name) { filename = full_name; |