Skip to content

Commit

Permalink
Only use collectionUri to build share link for /shareLink endpoint to…
Browse files Browse the repository at this point in the history
… minimize impact on SBH1
  • Loading branch information
cjmyers committed Dec 20, 2024
1 parent 469a663 commit fd6d8b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/getUrisFromReq.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ function getUrisFromReq (req, res) {
var webOfRegistries = config.get('webOfRegistries')
var prefix = config.get('databasePrefix')
prefix = prefix.substring(0, prefix.length - 1)
share = config.get('databasePrefix') + 'user/' + encodeURIComponent(req.params.userId) + '/' + designId + '/' + sha1('synbiohub_' + sha1(collectionUri) + config.get('shareLinkSalt')) + '/share'
if (req.url.endsWith('/shareLink')) {
share = config.get('databasePrefix') + 'user/' + encodeURIComponent(req.params.userId) + '/' + designId + '/' + sha1('synbiohub_' + sha1(collectionUri) + config.get('shareLinkSalt')) + '/share'
} else {
share = config.get('databasePrefix') + 'user/' + encodeURIComponent(req.params.userId) + '/' + designId + '/' + sha1('synbiohub_' + sha1(uri) + config.get('shareLinkSalt')) + '/share'
}
if (webOfRegistries[prefix]) {
share = share.replace(prefix, webOfRegistries[prefix])
}
Expand Down

0 comments on commit fd6d8b7

Please sign in to comment.