improve handling of text:... URLs

- don't require // after the colon
- open output files in text mode
This commit is contained in:
Mike Fährmann
2017-05-12 14:10:25 +02:00
parent 677c8ced11
commit 107d29ad8a
6 changed files with 12 additions and 13 deletions

View File

@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2016 Mike Fährmann
# Copyright 2014-2017 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Downloader module for text:// urls"""
"""Downloader module for text: urls"""
from .common import BasicDownloader
@@ -26,7 +26,7 @@ class Downloader(BasicDownloader):
self.out.start(pathfmt.path)
self.downloading = True
with pathfmt.open() as file:
file.write(bytes(url[7:], "utf-8"))
with pathfmt.open("w") as file:
file.write(url[5:])
self.downloading = False
self.out.success(pathfmt.path, 0)