diff --git a/src/lib/files.js b/src/lib/files.js index 4843c6f62..05e85ccda 100644 --- a/src/lib/files.js +++ b/src/lib/files.js @@ -69,12 +69,16 @@ export async function getDownloadLink (files, gatewayUrl, apiUrl, ipfs) { export async function getShareableLink (files, ipfs) { let hash + let filename if (files.length === 1) { hash = files[0].hash + if (files[0].type === 'file') { + filename = `?filename=${encodeURIComponent(files[0].name)}` + } } else { hash = await makeHashFromFiles(files, ipfs) } - return `https://ipfs.io/ipfs/${hash}` + return `https://ipfs.io/ipfs/${hash}${filename || ''}` }