[Kde-pim] Review Request 108974: Escape UIDs in resources that use them as filename
Kevin Krammer
krammer at kde.org
Tue Jul 9 17:55:29 BST 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/108974/#review35804
-----------------------------------------------------------
resources/contacts/contactsresource.cpp
<http://git.reviewboard.kde.org/r/108974/#comment26249>
I wonder if this is really necessary, QDir's ctor should be able to handle both kinds of input, no?
resources/contacts/contactsresource.cpp
<http://git.reviewboard.kde.org/r/108974/#comment26253>
Hmm. Maybe ensure no overwrite?
something like
QDir dir( directoryPath );
QFileInfo fileInfo;
do {
fileInfo = QFileInfo( dir, createUniqueId() + ".vcf" );
while ( fileInfo.exists() );
const QString fileName = fileInfo.absoluteFilePath();
const QString remoteId = fileInfo.fileName();
resources/contacts/contactsresource.cpp
<http://git.reviewboard.kde.org/r/108974/#comment26250>
KRandom::randomString()?
- Kevin Krammer
On July 9, 2013, 4:13 p.m., Dan Vrátil wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/108974/
> -----------------------------------------------------------
>
> (Updated July 9, 2013, 4:13 p.m.)
>
>
> Review request for KDEPIM.
>
>
> Description
> -------
>
> Contacts, vcarddir, icaldir and dav resources use KABC::Addressee::uid() or KCalCore::Incidence::uid() as part of the destination filenames. This fails if the UID contains unsafe characters like path delimiter, colon etc.
>
> This patch uses QUrl::toPercentEncoding() to make sure the UID is safe to use.
>
>
> Diffs
> -----
>
> resources/contacts/contactsresource.h ce92d6d
> resources/contacts/contactsresource.cpp 499f56e
>
> Diff: http://git.reviewboard.kde.org/r/108974/diff/
>
>
> Testing
> -------
>
> Successfully copied a contact from akonadi_googlecontacts_resource (which uses full http:// URL as UID) to akonadi_contacts_resource (which uses ~/.local/contacts/%contactUID%.vcard as filename).
>
>
> Thanks,
>
> Dan Vrátil
>
>
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list