Ticket #873 (closed defect: fixed)
file-sync needs to escape invalid filenames
| Reported by: | savago | Owned by: | dgollub |
|---|---|---|---|
| Priority: | high | Milestone: | OpenSync 0.40 |
| Component: | OpenSync | Version: | 0.37 |
| Severity: | normal | Keywords: | |
| Cc: | dgollub |
Description
Currently, file-sync plugin uses the reported change ID as filename. This works fine with other plugins (e.g. syncml) where each ID is just a number.
However, other plugins can use as ID strings with invalid filename characters (e.g. gdata entry ID http://www.google.com/m8/feeds/contacts/gcalntester%40gmail.com/base/1/1224183002447000).
There is the need to escape those invalid characters and this is what the attached patch does (it simply replaces those characters by '_').
I tried to be less invasive as possible, only changing the string used to create the file.
Attachments
Change History
Changed 3 years ago by savago
-
attachment
filename_escape.patch
added
comment:1 Changed 3 years ago by Graham Cobb
See ticket #209 for my proposed solution to this problem in 0.2x.
I don't like the proposed solution because it is not reversible. In 0.2x that was important so that when a slow sync occurred the file would not be considered to be new and get added as a new change on the other side. I don't know if it is still important in 0.3x but I would still prefer a mapping which was reversible and which guaranteed that there would be no clashes (two different objects mapping to the same filename).
My proposed solution was a quoting scheme where filenames which contained invalid characters (or the quoting character) were quoted (the bad characters were replaced with <quote-character>XX where XX was the hex code of the character). In #209 I proposed using ASCII DLE, which works on Unix systems but not on other systems. Something more portable (like ) could be used just as well.
Graham

Escapes invalid characters from ID used as filename