Ghost: Routes uploader requests `yml` file

Created on 18 Dec 2019  路  11Comments  路  Source: TryGhost/Ghost

Issue Summary

In Safari 13.0.4 on macOS 10.15.2, the 'Upload routes YAML' button triggers a file browser that only allows selection of files ending in .yml. These are not accepted by the application, which requires a .yaml extension. This results in routes not being uploadable with Safari.

To Reproduce

  1. In Safari, click the 'Upload routes YAML' button in Labs.

This doesn't happen in Firefox or Chrome. In Firefox, all files are selectable, in Chrome, yaml files are selectable.

Technical details:

  • Ghost Version: 3.2.0
  • Node Version: 10.18.0
  • Browser/OS: Safari 13.0.4
  • Database: MySQL
admin client bug good first issue help wanted

All 11 comments

Can't confirm the bug as not a Mac user, but think the right place to dig for a possible fix would be somewhere here - https://github.com/TryGhost/Ghost-Admin/blob/3.2.0/app/controllers/settings/labs.js#L28.

@formerandroider can you please provide a screenshot to confirm the behavior?

FWIW only the yaml extension is supported in the core, not yml

https://github.com/TryGhost/Ghost/blob/72679aefb9d332c9f9f2c9f6ef4d8296d88bdce9/core/frontend/services/settings/loader.js#L15-L18

I think the inherent issue is how browsers handle mime types. It might be easier to just specify the extension (e.g. .yaml) rather than the mime types, if all supported browsers understand it. MDN Ref

Yup, you are right @vikaspotluri123! Found this confirming commit from you - https://github.com/TryGhost/Ghost-Admin/commit/a5bfd3616

@gargol note the unelectable yaml file, but the selectable yml file.

Screenshot 2019-12-22 at 15 21 04

I downloaded a local copy and modified it such that the accept field on the actual file input consisted of the file extension rather than the MIME types, and that allowed me to select the correct file (though the changes I made weren't the best in terms of code quality).

@formerandroider can you please provide a screenshot to confirm the behavior?

I can confirm as well. Just went through the same issue today and was wondering what was up. Running on Ghost version 3.3.0. Same browser version.

Have checked the reason behind why there's only support for .yaml extension on the server-side. It's intentionally limited to one to be in line with the official recommendation - https://yaml.org/faq.html. The preference is to stick to the official extension name and not modify for quirky naming.

If this becomes a blocking or very ubiquitous problem we can review and reopen the issue.

The possible approach, if it has to be implemented, could be allowing for both extensions .yaml and .yml but renaming and saving uploaded file on the server-side using single standardized .yaml extension.

@gargol I think you鈥檙e somewhat missing the point. It鈥檚 not possible to choose .yaml flies when using Safari, only .yml files are enabled by the file picker, which are then blocked server side.

Oh! Sorry, completely had this backward then :sweat_smile: In that case it's strictly a frontend problem and any PR to fix this in Safari is welcome :v:

Ok, working on this now 馃憤

For the sake of ... workaround for this:

  1. rename it to routes.yml and try to upload
  2. you will get error
  3. rename to routes.yaml and it will let you upload it

It worked for me so may save you some time.

Was this page helpful?
0 / 5 - 0 ratings