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:
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user