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

关于下载地址获取的优化建议 #46

Open
coderWeil opened this issue Dec 11, 2017 · 5 comments
Open

关于下载地址获取的优化建议 #46

coderWeil opened this issue Dec 11, 2017 · 5 comments

Comments

@coderWeil
Copy link
Contributor

大神你好,我在使用TY这个库的时候,遇到了一个下载问题,现在下载地址是_fileName = _downloadURL.lastPathComponent;我在实际中遇到了一个情况是,如果url的lastPathComponent是规范的,截取出来是没有问题的,但是我们的地址出现了一些特殊字符的情况,下载下来后导致的结果是本地url可以获取到,但是在查找的时候找不到对应地址所在的视频,经过排查后发现是文件名称格式规范的问题,可能名称中带有了一些特殊符号,导致查询失败,这里我用下面的方法解决了,

if ([_downloadURL.lastPathComponent containsString:@"?"]) {
            NSArray *array = [_downloadURL.lastPathComponent componentsSeparatedByString:@"?"];
            _fileName = array.firstObject;
        }else {
            _fileName = _downloadURL.lastPathComponent;
        }

在设置_fileName的时候这样获取文件名,就可以避免格式问题

@12207480
Copy link
Owner

你可以提个pull request

@coderWeil
Copy link
Contributor Author

已经提了pull request,这是我自己遇到的问题,麻烦大神能检测一下,如果可行,能完善此库最好不过了

@12207480
Copy link
Owner

好的,在项目中使用了吗

@coderWeil
Copy link
Contributor Author

是的,目前已经用了

@12207480
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants