Skip to content

Commit

Permalink
Fix metadata for attachment list on Collection pages
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmyers committed Dec 21, 2024
1 parent d2a025c commit c63549d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ function getAttachmentsFromTopLevel (sbol, topLevel, share) {
attachments.push({
name: metaData.name,
type: 'unknown',
url: url
url: url,
size: -1,
sizeString: 'unknown'
})
}
}
Expand Down
17 changes: 17 additions & 0 deletions lib/views/topLevelView.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const prefixify = require('../prefixify')
const getComponentDefinitionMetadata = require('../query/local/component-definition.js')
const edamOntology = require('../ontologies/edam-ontology')
const namespace = require('../summarize/namespace')
const attachments = require('../attachments')

function getShortName (type) {
console.log('type is ' + type)
Expand Down Expand Up @@ -282,6 +283,22 @@ module.exports = function (req, res, type) {
})

return Promise.resolve()
}).then(() => {
var templateParams = {
uri: uri
}

var getAttachmentsQuery = loadTemplate('sparql/GetAttachments.sparql', templateParams)

return Promise.all([
sparql.queryJson(getAttachmentsQuery, graphUri).then((results) => {
var attachmentList = results

return attachments.getAttachmentsFromList(graphUri, attachmentList).then((results) => {
meta.attachments = results
})
})
])
}).then(function renderView () {
locals.meta = meta

Expand Down

0 comments on commit c63549d

Please sign in to comment.