Skip to content

Commit 62ded9c

Browse files
committed
Fix issues with share links and with attachements
1 parent e003945 commit 62ded9c

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

lib/summarize/summarizeAttachment.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function summarizeAttachment (attachment, req, sbol, remote, graphUri) {
2929

3030
var summary = {
3131
attachmentType: attachmentType,
32+
attachmentTypeUrl: attachment.format,
3233
attachmentHash: attachment.hash,
3334
attachmentName: 'Attachment',
3435
attachmentDownloadURL: attachmentDownloadURL(attachment, req),

lib/uriToUrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function uriToUrl (uri, req) {
1111
uri = uri.uri
1212
}
1313

14-
if (req && req.url.toString().endsWith('/share')) {
14+
if (req && req.url.toString().endsWith('/share') && uri.toString().startsWith(config.get('databasePrefix'))) {
1515
uri += '/' + sha1('synbiohub_' + sha1(uri.toString()) + config.get('shareLinkSalt')) + '/share'
1616
}
1717

lib/views/topLevelView.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ module.exports = function (req, res, type) {
305305
sparql.queryJson(getAttachmentsQuery, graphUri).then((results) => {
306306
var attachmentList = results
307307

308-
return attachments.getAttachmentsFromList(graphUri, attachmentList).then((results) => {
308+
return attachments.getAttachmentsFromList(graphUri, attachmentList,
309+
req && req.url.toString().endsWith('/share')).then((results) => {
309310
meta.attachments = results
310311
})
311312
})

templates/views/attachment.jade

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ block topLevelPropertyTable
2121
a(href='http://sbols.org/v2#format',title='Learn more about format')
2222
span.fa.fa-info-circle
2323
td #{meta.attachmentType}
24+
a(href=meta.attachmentTypeUrl.toString(),title='Learn more about this format type')
25+
span.fa.fa-info-circle  
2426

2527
if meta.attachmentDownloadURL
2628
tr

0 commit comments

Comments
 (0)