生成PDF时异常
报错图: https://ibb.co/F8C8hW5
https://ibb.co/KDqpXKj
@waynevan 抱歉,没有及时回复,本人大三,学业繁忙,无暇顾及,望谅解
https://ibb.co/KDqpXKj
这个是应为“章节名称”中“建立发送/接受”中“/”所导致的,这个与路径用的"/"重复; 确实我开发经验不足,没有考虑到这些特殊字符的影响,没有做"Escape Character",是我的失误,感谢你的反馈
可以用uuid模块,用于解决书名和章节名中有特殊字符的情况
生成如下的目录/文件:
wrs-temp/88bda22c-cbab-459b-a7ca-430301e0347a/aea20dc8-44cc-4a61-b781-5c370956f918.png
#import uuid
book_dir_name = str(uuid.uuid4())
dir_check(f'wrs-temp/{book_dir_name}')
......
png_name = f'wrs-temp/{book_dir_name}/{str(uuid.uuid4())}'
可以用uuid模块,用于解决书名和章节名中有特殊字符的情况 生成如下的目录/文件:
wrs-temp/88bda22c-cbab-459b-a7ca-430301e0347a/aea20dc8-44cc-4a61-b781-5c370956f918.png#import uuid book_dir_name = str(uuid.uuid4()) dir_check(f'wrs-temp/{book_dir_name}') ...... png_name = f'wrs-temp/{book_dir_name}/{str(uuid.uuid4())}'
Good suggestion. It's a good solution for escaping special characters in the chapter name, but it isn't suitable for the book name since users want to see the real book name. Anyway, if you have time, you can create a pull request to merge your solution to this repository. We will thank you for your contribution.
可以用uuid模块,用于解决书名和章节名中有特殊字符的情况 生成如下的目录/文件:
wrs-temp/88bda22c-cbab-459b-a7ca-430301e0347a/aea20dc8-44cc-4a61-b781-5c370956f918.png#import uuid book_dir_name = str(uuid.uuid4()) dir_check(f'wrs-temp/{book_dir_name}') ...... png_name = f'wrs-temp/{book_dir_name}/{str(uuid.uuid4())}'Good suggestion. It's a good solution for escaping special characters in the chapter name, but it isn't suitable for the book name since users want to see the real book name. Anyway, if you have time, you can create a pull request to merge your solution to this repository. We will thank you for your contribution.
The book_name keeps untouched. book_dir_name is just used for saving temp files.
(and, the book name need still might buggy in case it contains special characters for file name; this is another not fixed bug :))
btw, the only 4 lines code changes are as above mentioned, thus pull request not needed :)