After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 629800 - Gallery Export fails when Unicode characters are used in photo/album descriptions
Gallery Export fails when Unicode characters are used in photo/album descript...
Status: RESOLVED FIXED
Product: f-spot
Classification: Other
Component: Export
0.7.3
Other Linux
: Normal normal
: 0.8.1
Assigned To: F-spot maintainers
F-spot maintainers
Depends on:
Blocks:
 
 
Reported: 2010-09-15 21:58 UTC by Martin Slota
Modified: 2010-10-21 11:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix for FormClient.cs (105 bytes, patch)
2010-09-15 21:58 UTC, Martin Slota
committed Details | Review

Description Martin Slota 2010-09-15 21:58:23 UTC
Created attachment 170377 [details] [review]
Fix for FormClient.cs

I had a problem with Gallery Export when I included characters like "á" or "č" in photo descriptions. The export was unsuccessful, with an error message saying that the number of bytes sent was not identical to ContentLength (I'm sorry, I didn't record the full error message).

F-spot also regularly crashed (no error message, window simply disappeared) when I tried creating a Gallery2 album through its interface with those same characters in the album's description.

These problems occur in versions 6.1.5 and 7.3 and are always reproducible.

I believe I also found the source of these problems, which is in the FormClient class. As I understand it, this class takes care of submitting the HTTP form to the Gallery server. It seems that when Unicode characters are included in the strings that it sends (such as a photo description), it fails to compute the correct ContentLength. In case of albums, there is also no exception catching involved, so f-spot simply crashes. In case of photo imports, the problem exception is caught and so I get an error message.

Here's what fixed it for me (version 0.7.3):

==============================================================================
$ diff FormClient.cs_orig FormClient.cs
118c118
< 			length += value.Length + 2;
---
> 			length += Encoding.Default.GetBytes(value).Length + 2;
==============================================================================

I'm not sure whether "Encoding.Default" is the right way to get the right encoding, but apart from that I believe this fix should be suitable.

I'm sorry if this bug report is not as it should be, it is one of my first ones. If you need any more information, just tell me and I'll post it.
Comment 1 Ruben Vermeersch 2010-10-21 11:09:53 UTC
Comment on attachment 170377 [details] [review]
Fix for FormClient.cs

Good catch!

In the future, please submit patches using git format-patch, this makes it easer for me to include correct authorship information. I've converted your patch to a git patch for now.

Thanks for looking into this, will merge!