mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Merge pull request #87 from oceanprotocol/fix/return-urls
return file urls
This commit is contained in:
commit
349a6c7cf4
@ -18,7 +18,6 @@ import Config from "../models/Config"
|
||||
import ValueType from "../models/ValueType"
|
||||
import SecretStoreProvider from "../secretstore/SecretStoreProvider"
|
||||
import Logger from "../utils/Logger"
|
||||
import WebServiceConnectorProvider from "../utils/WebServiceConnectorProvider"
|
||||
import Account from "./Account"
|
||||
import DID from "./DID"
|
||||
import IdGenerator from "./IdGenerator"
|
||||
@ -221,7 +220,6 @@ export default class Ocean {
|
||||
|
||||
accessEvent.listenOnce(async () => {
|
||||
Logger.log("Awesome; got a AccessGranted Event. Let's download the asset files.")
|
||||
const webConnector = WebServiceConnectorProvider.getConnector()
|
||||
const contentUrls = await SecretStoreProvider
|
||||
.getSecretStore()
|
||||
.decryptDocument(d.getId(), metadataService.metadata.base.contentUrls[0])
|
||||
@ -233,15 +231,8 @@ export default class Ocean {
|
||||
let url: string = serviceUrl + `?url=${cUrl}`
|
||||
url = url + `&serviceAgreementId=${serviceAgreementId}`
|
||||
url = url + `&consumerAddress=${consumer.getId()}`
|
||||
Logger.log("Fetching asset from: ", url)
|
||||
const response: any = await webConnector.get(url)
|
||||
const responseBuffer: Buffer = await response.buffer()
|
||||
const urlParts: string[] = cUrl.split("/")
|
||||
const filename: string = urlParts[urlParts.length - 1]
|
||||
Logger.debug(`Got response: filename is ${filename}, url is ${response.url}`)
|
||||
files.push(responseBuffer.toString("utf8"))
|
||||
files.push(url)
|
||||
}
|
||||
Logger.log("Done downloading asset files.")
|
||||
|
||||
cb(files)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user