decap-cms: Entries with complex extensions do not appear in collection view

- Do you want to request a feature or report a bug?

bug hunt 👾

- What is the current behavior?

Entries that have a complex extension — eg: html.md — can be created in the CMS, but do not appear in the collection view.

- If the current behavior is a bug, please provide the steps to reproduce.

Set extension: "html.md" and format: frontmatter. In the CMS, create a new entry in that collection. Entry is committed successfully, with the custom extension. Entry does not appear in the collection view.

- What is the expected behavior?

Entry should appear in the collection view.

- Please mention your CMS, node.js, and operating system version.

Netlify CMS version 0.7.6, deployed to Netlify

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 17 (10 by maintainers)

Most upvoted comments

We should support this.

Yes, Hugo multilingual requires complex extensions, and it would be great if Netlify CMS could be fixed to support them.

For example, currently example.fr.md is changed to example-fr.md - Hugo requires that the extension remains .fr.md

Same issue here. I’m deploying a multilingual host with HUGO which requires a complex extension. It’d be great to allow this.

@kornichon2000 there were issues with static site generators or deployments or something that made us rule out periods. Plus slugs traditionally have periods stripped, I’d consider that widely expected behavior.

@tech4him1 endsWith is exactly what I was thinking, agreed.

I think a simple fix would be to simple check if the file ends with the extensions specified:

files.filter(file => file.name.endsWith('.' + extension))

We would want to check it with a period prepended to the extension, so that we wouldn’t accidently match part of the file name (i_like_tar.gz should not be matched by tar.gz, but i_like.tar.gz should).

We’ll take a PR if anyone is up for digging in.

@tech4him1 since we’re only using this check in one place and not for general extension checking, just using endsWith should be fine.