diff --git a/src/CoreApi/FileSystemApi.cs b/src/CoreApi/FileSystemApi.cs index 17c851df..ada7db8d 100644 --- a/src/CoreApi/FileSystemApi.cs +++ b/src/CoreApi/FileSystemApi.cs @@ -105,11 +105,20 @@ public async Task AddAsync( { var link = node.ToLink(name); var wlinks = new IFileSystemLink[] { link }; - return await CreateDirectoryAsync(wlinks, options, cancel).ConfigureAwait(false); + node = await CreateDirectoryAsync(wlinks, options, cancel).ConfigureAwait(false); + } + else + { + node.Name = name; + } + + // Advertise the root node. + if (options.Pin && ipfs.IsStarted) + { + await ipfs.Dht.ProvideAsync(node.Id, advertise: true, cancel: cancel).ConfigureAwait(false); } // Return the file system node. - node.Name = name; return node; } diff --git a/src/IpfsEngine.csproj b/src/IpfsEngine.csproj index 33fb4c31..151d486a 100644 --- a/src/IpfsEngine.csproj +++ b/src/IpfsEngine.csproj @@ -40,7 +40,7 @@ - +