Opened 6 years ago

Closed 6 years ago

#935 closed defect (fixed)

Raw Image gets unicodedecodeerror on logging debug data

Reported by: Odin Hørthe Omdal (Velmont) Owned by:
Priority: major Milestone:
Component: programming Keywords: exception
Cc: Christopher Allan Webber, Elrond Parent Tickets:

Description

Forgot to encode to utf-8 first.

Have patch.

Subtickets

Attachments (2)

0001-Raw-image-mediatype-has-a-logging-call-not-encoding-.patch (1.3 KB) - added by Odin Hørthe Omdal (Velmont) 6 years ago.
0001-Raw-image-mediatype-had-a-non-unicode-logging-call.patch (1.2 KB) - added by Odin Hørthe Omdal (Velmont) 6 years ago.

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by Odin Hørthe Omdal (Velmont)

comment:1 Changed 6 years ago by Christopher Allan Webber

Hm. I think this may be backwards! Encoding to utf-8 means encoding to a bytestring, which it looks like yeah, the parent is also a bytestring in python2, so not surprising this is happening.

However, I think it might be better if we did the reverse... instead,

'Wrote new file from {0} to preview (jpg) {1}' should become u'Wrote new file from {0} to preview (jpg) {1}'

In that case, I don't think you need to encode (if anything, maybe decode, but you shouldn't decode something if it's already unicode, which it looks like this probably is?)

Could you test that and see if it works? If so, I'd be happy to merge this in.

comment:2 Changed 6 years ago by Odin Hørthe Omdal (Velmont)

lol, true.

I am in Python 3 land myself, unicode is simpler there :) Of course you're very right. I'll change, test and upload. :)

Changed 6 years ago by Odin Hørthe Omdal (Velmont)

comment:3 Changed 6 years ago by Odin Hørthe Omdal (Velmont)

Don't know how to delete the old patch, -- since I changed the name on this new one.

comment:4 Changed 6 years ago by ShawnRisk

Owner: Odin Hørthe Omdal (Velmont) deleted
Status: newreview

This should always be put in review if there is patch added to the ticket and this needs to be checked by others.

comment:5 Changed 6 years ago by Odin Hørthe Omdal (Velmont)

This really is more or less reviewed, since I did just what Chris said :)

Also have the commit on-web (not in its own branch, but on my own patch-list that I rebase on top of upstream/master):

https://github.com/Velmont/mediagoblin/commit/6907027ec1a9d24d9dd7fc8c1816782ab9cc00a2

comment:6 Changed 6 years ago by Christopher Allan Webber

Resolution: fixed
Status: reviewclosed

Merged, rebased, pushed. Thank you!

Note: See TracTickets for help on using tickets.