Skip to content
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

Merged
merged 1 commit into from
Jan 23, 2020
Merged

fix ipfs upload #2544

merged 1 commit into from
Jan 23, 2020

Conversation

yann300
Copy link
Collaborator

@yann300 yann300 commented Jan 18, 2020

@yann300 yann300 force-pushed the fixIPFSUpload branch 4 times, most recently from b08adc4 to 2c66e86 Compare January 19, 2020 20:30
@@ -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
Copy link
Collaborator

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?

// 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]
Copy link
Collaborator

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

@@ -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) {
Copy link
Collaborator

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?

@@ -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
Copy link
Collaborator

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?

@yann300
Copy link
Collaborator Author

yann300 commented Jan 23, 2020

ok added the changes @Aniket-Engg

@yann300 yann300 merged commit a1d7198 into master Jan 23, 2020
@yann300 yann300 deleted the fixIPFSUpload branch January 23, 2020 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metadata Inconsistency
2 participants