single quotes in titles are not escaped in YAML

Bug #369022 reported by L. Doherty
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
RescueTime Linux Uploader
Fix Released
High
Piotr Kilczuk

Bug Description

about 1/3 of my uploads fail because there is an entry in the upload file in which the window_title contains a single quote (which is not escaped - obviously the server fails to parse.) I tested it against the parser at http://yaml.org/cgi-bin/ypaste.pl to confirm.

Sorry about no patch - I may be able to help out in the future but at the moment both Linux and Python are new to me.

Changed in rescuetime-linux-uploader:
status: New → Confirmed
Revision history for this message
Matt Winkelmann (matthias-winkelmann+launchpad) wrote :

There's a patch attached that solves this by escaping single quotes. There are other characters, especially in website titles, that lead to apparently malformed yaml, such as the “ in this page's title. As far as I understand, yaml should work with all unicode characters, therefore the problem might actually be on the server side. A quick fix would be to basically whitelist a standard range of characters (a-Z0-9,[]()!@#$$ etc.) and remove everything else via regex. Using an existing, tested yaml library might be even better.

Anyway, please try the patch attached. I suspect single quotes were responsible for a majority of these failed uploads.

Instructions: save patch in RescueTimeUploader, then patch -o uploader.py uploader.py quotes.diff
Install per README.

Please report back on any changes. Note that old files in /failed will not be corrected.

Revision history for this message
nrafal (rafal-nrafal) wrote :

For me it didn't help - still got YAML errors when there's a single quote in app name. So I came up with simple solution - remove all single quotes ;)
It helped, and now everything seems to be ok. For everyone who doesn't care about presence of single quotes, I'm putting modified patch.

Revision history for this message
Codegram (info-codegram) wrote :

I've fixed these issues:

1.- YAML output. Now it outputs tag: "value" instead of tag: 'value', so that escaped 's won't cause a problem.
2.- Firefox extension. Now it supports being installed in firefox 3.5 and above.
3.- Added support for firefox 3.5 (shiretoko) so that it has its own .mozilla/firefox-3.5/currentURL file.

Revision history for this message
Akintayo (akintayo) wrote :

@Codegram
The double quotes fix doesn't work when there are double quotes in the title. E.g. (Bug #369022 in RescueTime Linux Uploader: “single quotes in titles are not escaped in YAML” - Mozilla Firefox), would fail.

Changed in rescuetime-linux-uploader:
importance: Undecided → Medium
importance: Medium → High
assignee: nobody → Piotr Kilczuk (p-kilczuk)
Changed in rescuetime-linux-uploader:
status: Confirmed → In Progress
Revision history for this message
Piotr Kilczuk (p-kilczuk) wrote :

New tarball addressing this issue will be realeased this week.

Changed in rescuetime-linux-uploader:
status: In Progress → Fix Committed
Changed in rescuetime-linux-uploader:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.