-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some issues to work on my ceiba #16
base: master
Are you sure you want to change the base?
Changes from 1 commit
6f9f504
4728d90
5383f8c
58f5bf5
915b6b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ | |
import pycurl | ||
import urllib.parse | ||
|
||
from pathvalidate import sanitize_filepath | ||
|
||
class Error(Exception): | ||
def __str__(self): | ||
return self.message | ||
|
@@ -237,6 +239,7 @@ def download_file(self, path, retry, dcb, ecb): | |
|
||
def download_link(self, path, node, retry, dcb, ecb): | ||
disk_path_object = pathlib.Path(path.lstrip('/')) | ||
disk_path_object = pathlib.Path(sanitize_filepath(str(disk_path_object))) | ||
disk_path = str(disk_path_object) | ||
if self.vfs.is_internal_link(node): | ||
link_target_path = str(pathlib.PurePath(node.read_link())) | ||
|
@@ -283,7 +286,8 @@ def download_link(self, path, node, retry, dcb, ecb): | |
|
||
def download_regular(self, path, node, retry, dcb, ecb): | ||
disk_path_object = pathlib.Path(path.lstrip('/')) | ||
|
||
disk_path_object = pathlib.Path(sanitize_filepath(str(disk_path_object))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 如同我在 #15 (comment) 所說,我覺得這個可以移入 |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 請刪除行尾空白。 |
||
def ccb(*args): | ||
return dcb(path, *args) | ||
|
||
|
@@ -355,6 +359,7 @@ def disk_path_object_open(mode): | |
|
||
def download_directory(self, path, node, retry, dcb, ecb): | ||
disk_path_object = pathlib.Path(path.lstrip('/')) | ||
disk_path_object = pathlib.Path(sanitize_filepath(str(disk_path_object))) | ||
if disk_path_object.is_dir(): | ||
self.logger.info('跳過已經存在的資料夾 {}' \ | ||
.format(str(disk_path_object))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
請仿照其他檔案,把所有的
from ... import ...
排在一起,並照字母排序。由於
pathvalidate
不在 Python 標準函式庫中,需要額外安裝才能使用,因此請一併修改README.asciidoc
、configure.ac
、requirements.txt
讓使用者知道這件事。