Skip to content

Commit

Permalink
Handle page, string id in url
Browse files Browse the repository at this point in the history
  • Loading branch information
evanp committed Apr 22, 2018
1 parent 9adc84d commit 3372398
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/fromas2.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,20 @@ function copyObjectProperties(imported, copy, callback) {
},
function(err, links) {
if (err) throw err;
links = _.map(links, maybeJustID);
_.each(links, (link) => {
if (isAudio(imported) && isAudioMediaLink(link)) {
if (_.isString(link)) {
addProperty(copy, "url", link);
} else if (isAudio(imported) && isAudioMediaLink(link)) {
addProperty(copy, "stream", link);
} else if (isVideo(imported) && isVideoMediaLink(link)) {
addProperty(copy, "stream", link);
} else if (isHTMLMediaLink(link)) {
copy.url = link.url;
addProperty(copy, "url", link.url);
} else if (isDocument(imported) && !_.has(copy, "fileUrl")) {
copy.fileUrl = link.url;
addProperty(copy, "fileUrl", link.url);
if (_.has(link, "dc.format")) {
copy.mimeType = _.get(link, "dc.format");
addProperty(copy, "mimeType", _.get(link, "dc.format"));
}
} else {
addLink(copy, "alternate", mediaLinkToLink(link));
Expand Down
13 changes: 13 additions & 0 deletions test/as2-to-as1-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,4 +430,17 @@ vows.describe("AS2 -> AS1 conversion")
}
}
))
.addBatch(convert(
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Page",
"name": "Omaha Weather Report",
"url": "http://example.org/weather-in-omaha.html"
},
{
"objectType": "page",
"displayName": "Omaha Weather Report",
"url": "http://example.org/weather-in-omaha.html"
}
))
.export(module);

0 comments on commit 3372398

Please sign in to comment.