feat: support for bzz.link cids when downloading files (#350)

* feat: detect and extract bzz.link cids into hash when downloading files

* test: add quite thorough testsuite
This commit is contained in:
Vojtech Simetka
2022-04-25 20:38:36 +05:00
committed by GitHub
parent a67be7a31e
commit 3784b29f14
4 changed files with 176 additions and 18 deletions
+1 -15
View File
@@ -8,7 +8,7 @@ import { History } from '../../components/History'
import { Context, defaultUploadOrigin } from '../../providers/File'
import { Context as SettingsContext } from '../../providers/Settings'
import { ROUTES } from '../../routes'
import { extractSwarmHash } from '../../utils'
import { recognizeSwarmHash } from '../../utils'
import { determineHistoryName, HISTORY_KEYS, putHistory } from '../../utils/local-storage'
import { FileNavigation } from './FileNavigation'
@@ -71,20 +71,6 @@ export function Download(): ReactElement {
}
}
function recognizeSwarmHash(value: string) {
if (value.length < 64) {
return value
}
const hash = extractSwarmHash(value)
if (hash) {
return hash
}
return value
}
return (
<>
<FileNavigation active="DOWNLOAD" />