🐛 Fixed unselectable routes files in macOS Safari (#1472)

closes TryGhost/Ghost#11472

- adds an explicit `.yaml` to the `accepts` attribute of the routes file uploader to work around Safari only allowing `.yml` to be selected when given the yaml mime type
This commit is contained in:
Liam Williams 2020-05-08 12:05:55 +01:00 committed by GitHub
parent a30f0b2851
commit 06531daf85
2 changed files with 6 additions and 1 deletions

View File

@ -54,6 +54,8 @@ export default Controller.extend({
yamlExtension: null,
yamlMimeType: null,
yamlAccept: null,
init() {
this._super(...arguments);
this.importMimeType = IMPORT_MIME_TYPES;
@ -61,6 +63,9 @@ export default Controller.extend({
this.jsonMimeType = JSON_MIME_TYPE;
this.yamlExtension = YAML_EXTENSION;
this.yamlMimeType = YAML_MIME_TYPE;
// (macOS) Safari only allows files with the `yml` extension to be selected with the specified MIME types
// so explicitly allow the `yaml` extension.
this.yamlAccept = [...this.yamlMimeType, ...Array.from(this.yamlExtension, extension => '.' + extension)];
},
actions: {

View File

@ -206,7 +206,7 @@
{{/if}}
<div style="display:none">
<GhFileInput @multiple={{false}} @action={{uploader.setFiles}} @accept={{this.yamlMimeType}} data-test-file-input="routes" />
<GhFileInput @multiple={{false}} @action={{uploader.setFiles}} @accept={{this.yamlAccept}} data-test-file-input="routes" />
</div>
</div>
</GhUploader>