-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix ipfs upload #2544
fix ipfs upload #2544
Conversation
b08adc4
to
2c66e86
Compare
src/lib/publishOnIpfs.js
Outdated
@@ -27,11 +27,21 @@ module.exports = (contract, fileManager, cb, ipfsVerifiedPublishCallBack) => { | |||
|
|||
async.eachSeries(Object.keys(metadata.sources), function (fileName, cb) { | |||
// find hash | |||
var hash | |||
var hash = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use let
here?
src/lib/publishOnIpfs.js
Outdated
// TODO: refactor this with publishOnSwarm | ||
if (metadata.sources[fileName].urls) { | ||
metadata.sources[fileName].urls.forEach(url => { | ||
if (url.indexOf('ipfs') !== -1) hash = url.match('dweb:/ipfs/(.+)')[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you consider using .includes
instead of .indexOf
on all the places
src/lib/publishOnIpfs.js
Outdated
@@ -94,7 +104,7 @@ module.exports = (contract, fileManager, cb, ipfsVerifiedPublishCallBack) => { | |||
async function ipfsVerifiedPublish (content, expectedHash, cb) { | |||
try { | |||
const results = await severalGatewaysPush(content) | |||
if (results !== expectedHash) { | |||
if (expectedHash !== null && results !== expectedHash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do (expectedHash&& results !== expectedHash)
for all similar places?
src/lib/publishOnSwarm.js
Outdated
@@ -20,11 +20,21 @@ module.exports = (contract, fileManager, cb, swarmVerifiedPublishCallBack) => { | |||
|
|||
async.eachSeries(Object.keys(metadata.sources), function (fileName, cb) { | |||
// find hash | |||
var hash | |||
var hash = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use let
here?
2c66e86
to
91c78bf
Compare
ok added the changes @Aniket-Engg |
fix https://github.com/ethereum/remix-ide/issues/2540