Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Commit

Permalink
fix: Check if link is well formed
Browse files Browse the repository at this point in the history
Fixed #4
  • Loading branch information
trodrigues committed Feb 24, 2016
1 parent 46e20d8 commit 51b8fd2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/find-entry-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function findEntryLinks (entries) {
each(entries, entry => {
each(entry.fields, (field, fieldId) => {
each(field, (locale, localeId) => {
if (isPlainObject(locale) && locale.sys.type === 'Link') {
if (isPlainObject(locale) && get(locale, 'sys.type') === 'Link') {
entryLinks.push({
entryId: entry.sys.id,
link: locale,
Expand Down
3 changes: 2 additions & 1 deletion test/find-entry-links-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ test('Find 3 links in 2 entries', t => {
fields: {
name: {locale: 'name'},
image: {locale: {sys: {id: '123', type: 'Link', linkType: 'Asset'}}},
article: {locale: {sys: {id: '456', type: 'Link', linkType: 'Entry'}}}
article: {locale: {sys: {id: '456', type: 'Link', linkType: 'Entry'}}},
malformedlink: {locale: {}}
}
},
{
Expand Down

0 comments on commit 51b8fd2

Please sign in to comment.