Search code examples
apostrophe-cms

Impossible to retrieve the attachment url


I have the piece article with a field for files

module.exports = {
extend: 'apostrophe-pieces',
name: 'article',
label: 'Article',
pluralLabel: 'Articles',
orderings: true,
addFields: [
 Other fields...
 {
    name: 'files',
    label: 'Files',
    type: 'singleton',
    widgetType: 'apostrophe-files'
  },
 ]
};

And in the html I've use the apostrophe-files widget

  {{ apos.singleton(data.piece, 'files', 'apostrophe-files') }}

It works fine when I show them in the html, but when I click the links created to download the file, it gives me the error in the console.

Template warning: Impossible to retrieve the attachment url since it is missing, a default icon has been set. Please fix this ASAP!

I can't see what I'm doing wrong.


Solution

  • I don't now exactly why, but it seems that it didn't work because I've uploaded the file a few days ago, and the url of the attachment changed for some reason. I put in the trash the files, and added new ones and it worked fine.