Can't upload theme from file


(Jay Pfaffman) #1

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.


Theme import via file not working
Themes stop working if a child theme contains assets
(Pad Pors) #2

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


(Joshua Rosenfeld) #3

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


(Jay Pfaffman) #4

Well here’s an error log:

  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.


(cpradio) #5

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


(Jay Pfaffman) #6

Yes. I see it now. Like

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

(cpradio) #7

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


(Jay Pfaffman) #8

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?


(cpradio) #9

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


(Jay Pfaffman) #10

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

Thanks, @cpradio!


(cpradio) #11

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.


(Sam Saffron) #13

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


(Sam Saffron) #14

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