nystudio107 / craft-seomatic

SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
https://nystudio107.com/plugins/seomatic
Other
162 stars 68 forks source link

`security.txt` file does not end with newline (carriage return) by default #1429

Closed WilliamDEdwards closed 4 months ago

WilliamDEdwards commented 4 months ago

Describe the bug

SEOmatic allows one to configure security.txt files. That file does not end with a newline (carriage return), unless it explicitly ends with an empty line. That causes the file to be invalid.

To reproduce

Steps to reproduce the behaviour:

  1. Log into Craft CMS' admin panel
  2. Navigate to SEOmatic -> Global SEO -> Security
  3. Set 'Security.txt Template' to a value that does not end with an empty line, such as:
Contact: mailto:info@cyberfusion.io
Expires: {{ date('+1 year')|atom }}
Preferred-Languages: en, nl
Canonical: https://cyberfusion.io/.well-known/security.txt

The newline is added only when explicitly adding an empty line:

Contact: mailto:info@cyberfusion.io
Expires: {{ date('+1 year')|atom }}
Preferred-Languages: en, nl
Canonical: https://cyberfusion.io/.well-known/security.txt

Expected behaviour

The security.txt file that SEOmatic generates should always end with a newline (carriage return). It's invalid otherwise.

Screenshots

N/A

Versions

khalwat commented 4 months ago

So you would like SEOmatic to automatically add a newline if one is not present?

WilliamDEdwards commented 4 months ago

So you would like SEOmatic to automatically add a newline if one is not present?

If we don’t want invalid security.txt files without relying on users to add an empty line to all their configurations (which, from a UX standpoint, is probably not great), then yes.

khalwat commented 4 months ago

Addressed in the above commits.

Craft CMS 3:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-seomatic": "dev-develop as 3.4.73”,

Then do a composer clear-cache && composer update

…..

Craft CMS 4:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-seomatic": "dev-develop-v4 as 4.0.43”,

Then do a composer clear-cache && composer update

…..

Craft CMS 5:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-seomatic": "dev-develop-v5 as 5.0.0-beta.6”,

Then do a composer clear-cache && composer update