Theme import via file not working

AI-generated summary

The “Theme import via file” feature is not working as expected. tshenry reported that when trying to import a theme file through the Admin Panel, the .dcstyle.json files are greyed out in the file chooser. simon suggested selecting “All Files” in the file chooser options to resolve the issue. However, simon later confirmed that this is a bug in Chrome and Firefox.

As a workaround, bartv suggested dragging the file onto the “Choose file” button on OSX.

sam proposed a possible fix by modifying the accepted file types in the code. sam then successfully tested the fix by adding .dcstyle.json to the accepted file types.

riking noted that allowing .json files is important and provided a code snippet from the Discourse Data Explorer that supports this.

I haven’t had to use this in a while, but a need arose today. I tried on two different sites and am unable to import a theme file through the Themes page of the Admin Panel. When I click on the import button and open the file chooser, all the .dcstyle.json theme files listed are greyed out.

Not sure if anything here could be related:

Any thoughts?

1 Like

If you file chooser has an Options button, click it, and then select All Files. That should let you upload the file.

3 Likes

Is this a legit bug or is the UI unclear here?

It’s a bug, at least in Chrome and Firefox.

3 Likes

As a workaround, in OSX you can also drag the file onto the ‘Choose file’ button:

5 Likes

This is a weird mac issue. Let’s try this and see how we go:

https://github.com/discourse/discourse/commit/73688413744ae141690e86f2e1e5395c31d1ba12

5 Likes

I remember trying to fix this with Data Explorer too… what’s the <input> look like for that?

I hacked this in accept='.dcstyle.json,application/json' it seems to be ok in my vm

Answer:

 return ".json,application/json,application/x-javascript,text/json" + (this.get('extension') ? "," + this.get('extension') : "");

https://github.com/discourse/discourse-data-explorer/blob/master/assets/javascripts/discourse/components/json-file-uploader.js.es6#L44-L46

I think that allowing .json is probably important.

This topic was automatically closed after 27 hours. New replies are no longer allowed.