~chicharreros/magicicada-client/1.0

« back to all changes in this revision

Viewing changes to ubuntuone/syncdaemon/sync.py

  • Committer: Magicicada Bot
  • Author(s): Facundo Batista
  • Date: 2018-03-09 21:17:37 UTC
  • mfrom: (1437.1.1 fix-logging-escaping)
  • Revision ID: magicicada_bot-20180309211737-45nl1k3j9vs4sng0
[r=nataliabidart] Fixed the path escaping when logging sync actions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- coding: utf-8 -*-
2
2
#
3
3
# Copyright 2009-2012 Canonical Ltd.
 
4
# Copyright 2015-2018 Chicharreros
4
5
#
5
6
# This program is free software: you can redistribute it and/or modify it
6
7
# under the terms of the GNU General Public License version 3, as published
265
266
                path = self.key.safe_get('path')
266
267
            extra = dict(message=message,
267
268
                         mdid=self.key.safe_get("mdid"),
268
 
                         path=path.replace('%', '%%'),   # escape %
 
269
                         path=path,
269
270
                         share_id=self.key.safe_get("share_id") or 'root',
270
271
                         node_id=self.key.safe_get("node_id"),
271
272
                         hasmd=self.key.has_metadata(),
280
281
                         isdir="-",
281
282
                         changed="-")
282
283
            extra.update(self.key.keys)
 
284
 
 
285
        # escape any % in the path and build the message
 
286
        extra['path'] = extra['path'].replace('%', '%%')
283
287
        message = format % extra
 
288
 
284
289
        if lvl == -1:
285
290
            kwargs.update({'exc_info': exc_info})
286
291
            self.logger.error(message, *args, **kwargs)