Skip to content
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

当漫画标题开头或结尾有空格时会无法下载 #4

Closed
Telloyee opened this issue Jan 17, 2022 · 1 comment
Closed

当漫画标题开头或结尾有空格时会无法下载 #4

Telloyee opened this issue Jan 17, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@Telloyee
Copy link

目前只试过漫画,有这个问题,不知道直播和视频标题有/会不会也下载不了
比如说这个:
https://manga.bilibili.com/detail/mc25632

@vooidzero vooidzero changed the title 当标题中含有"/“时会无法下载 当漫画标题开头或结尾有空格时会无法下载 Jan 17, 2022
@vooidzero
Copy link
Owner

vooidzero commented Jan 17, 2022

@Telloyee 感谢反馈。
斜杠的问题在开发最初的时候就考虑了:标题中的 \/:*?"<>| 会相应地替换为全角字符。

这里的问题其实是合成标题的时候末尾有空格,然后创建了一个末尾有空格的文件夹,之后在这个文件夹里创建文件失败(小提一句,这个在 Linux 平台上是没问题的)。

Release 已更新,请先删除该漫画下载任务以及文件夹(这文件夹好像不太好删?),然后才能在更新的版本下载该漫画


解决方法:在创建下载任务时移去标题开头和末尾的空格。

相关文件:utils.cpp

QString Utils::legalizedFileName(QString title)
{
-    return title.replace('\\', u'\').replace('/', u'/').replace(':', u':')
+    return title.simplified()
+            .replace('\\', u'\').replace('/', u'/').replace(':', u':')
             .replace('*', u'*').replace('?', u'?').replace('"', u'“')
             .replace('<', u'<').replace('>', u'>').replace('|', u'|');
}

@vooidzero vooidzero added the bug Something isn't working label Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants