Skip to content

Commit

Permalink
Special case images to accomodate for legacy non-dir images (#747)
Browse files Browse the repository at this point in the history
* Case for legacy non-dir images

* Change from sourceFile to fileName to keep it consistent with the property being passed into function
  • Loading branch information
dmanjunath committed Aug 11, 2020
1 parent 48e29e0 commit 5fc3a6a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions creator-node/src/routes/nodeSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,12 @@ async function _nodesync (req, walletPublicKeys, creatorNodeEndpoint) {
// The files inside the directory are synced separately
if (nonTrackFile.type !== 'dir') {
// if it's an image file, we need to pass in the actual filename because the gateway request is /ipfs/Qm123/<filename>
if (nonTrackFile.type === 'image') {
// need to also check fileName is not null to make sure it's a dir-style image. non-dir images won't have a 'fileName' db column
if (nonTrackFile.type === 'image' && nonTrackFile.fileName !== null) {
return saveFileForMultihash(req, nonTrackFile.multihash, nonTrackFile.storagePath, userReplicaSet, nonTrackFile.fileName)
} else return saveFileForMultihash(req, nonTrackFile.multihash, nonTrackFile.storagePath, userReplicaSet)
} else {
return saveFileForMultihash(req, nonTrackFile.multihash, nonTrackFile.storagePath, userReplicaSet)
}
}
}
))
Expand Down

0 comments on commit 5fc3a6a

Please sign in to comment.