# Can't upload theme from file

**URL:** https://meta.discourse.org/t/cant-upload-theme-from-file/73376
**Category:** Bug
**Created:** [November 3, 2017, 6:09pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376 "2017-11-03T18:09:15Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 3, 2017, 6:09pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/1 "2017-11-03T18:09:15Z")

</div>

I just tried to import a theme from a file. When I select “from my device” I get the selector and choose the file, but then the “upload” button doesn’t do anything. I tested on two instances Discourse 1.9.0.beta13 and Discourse 1.9.0.beta14.

Tested Chome and Firefox on Linux.

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [November 3, 2017, 6:50pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/2 "2017-11-03T18:50:53Z")

</div>

I had the same problem with themes which has some files attached (as uploads). simple css-html themes without any attachment were ok.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [November 3, 2017, 8:14pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/3 "2017-11-03T20:14:03Z")

</div>

Hmm…I can’t reproduce this on a test hosted site. I exported and uploaded Theme Test and ran into no issues.

 ![image](https://global.discourse-cdn.com/meta/original/3X/3/d/3d282c8f966d39de91d133112aa1de98b8c3dfd7.png)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 3, 2017, 8:54pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/4 "2017-11-03T20:54:08Z")

</div>

Well here’s an error log:

```plaintext
  Parameters: {"theme"=>#<ActionDispatch::Http::UploadedFile:0x00007fc32bc88958 @tempfile=#<Tempfile:/tmp/RackMultipart20171103-338-1gjeut6.json>, @original_filename="mrf-tweaks.dcstyle.json", @content_type="application/json", @headers="Content-Disposition: form-data; name=\"theme\"; filename=\"mrf-tweaks.dcstyle.json\"\r\nContent-Type: application/json\r\n">}
Completed 500 Internal Server Error in 4ms (ActiveRecord: 0.5ms)
RuntimeError (Unknown type passed to set field)
/var/www/discourse/app/models/theme.rb:253:in `set_field'

```

This is strange because I downloaded this file from this very same server before uploading a new import.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [November 3, 2017, 9:18pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/5 "2017-11-03T21:18:45Z")

</div>

I’m assuming it has an upload/asset? I think that is the key to the error (if that is true for your case)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 3, 2017, 9:20pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/6 "2017-11-03T21:20:34Z")

</div>

Yes. I see it now. Like

```json
      {
        "name": "logo-square",
        "target": "common",
        "value": "",
        "type_id": 2,
        "upload_id": 7612,
        "url": "/uploads/default/original/2X/e/eb4f8eaa4183d055ad75c5dfcf5010b67248862a.png",
        "filename": "site-Square.png"
      },

```

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [November 3, 2017, 9:26pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/7 "2017-11-03T21:26:40Z")

</div>

If you comment out the filename for now (and re-upload it after), does it work?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 3, 2017, 9:35pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/8 "2017-11-03T21:35:40Z")

</div>

Hmm. I tried deleting the section I included above, and then tried deleting the “filename”: “fil.png” part (and preceding comma). But no joy.

You want me to PM you the file?

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [November 3, 2017, 9:39pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/9 "2017-11-03T21:39:50Z")

</div>

Sure, I can play around with it on my sandbox tonight (or should be able to)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 3, 2017, 10:00pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/10 "2017-11-03T22:00:09Z")

</div>

Removing the upload solved the problem. Definitely seems like a bug, though.

Thanks, @cpradio!

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [November 3, 2017, 10:08pm UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/11 "2017-11-03T22:08:04Z")

</div>

I can definitely recreate the issue when there is an asset/upload as part of the theme, once that is removed, the import works fine.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 14, 2017, 5:31am UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/13 "2017-11-14T05:31:31Z")

</div>

This is a rather hairy change, uploads are now base64 encoded in the json payload for theme export.

[https://github.com/discourse/discourse/commit/47e4c9bb468fca10f4818df3bc44a67990eb75aa](https://github.com/discourse/discourse/commit/47e4c9bb468fca10f4818df3bc44a67990eb75aa)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 15, 2017, 7:00am UTC](https://meta.discourse.org/t/cant-upload-theme-from-file/73376/14 "2017-11-15T07:00:07Z")

</div>

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