Piwik: Simply ignore link materials with empty URL

This commit is contained in:
Adrian Moennich 2015-05-05 10:04:54 +02:00
parent 44acb37507
commit 2a75be9b1f

View File

@ -95,6 +95,9 @@ class PiwikPlugin(IndicoPlugin):
def track_download(self, event, resource, **kwargs):
tracker = PiwikQueryTrackDownload()
resource_url = request.url if isinstance(resource, LocalFile) else resource.getURL()
if not resource_url:
# Some very old events apparently have link resources with an empty URL
return
resource_title = resource.getFileName() if isinstance(resource, LocalFile) else resource.getURL()
resource_title = 'Download - {}'.format(resource_title)
tracker.call(resource_url, resource_title)