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

存在2个bug #50

Open
orestonce opened this issue Jul 21, 2022 · 0 comments
Open

存在2个bug #50

orestonce opened this issue Jul 21, 2022 · 0 comments

Comments

@orestonce
Copy link

  1. getHost的时候应该使用 path.Dir,而不是filepath.Dir, 具体看 go/src/path/filepath/path.go:9 的注释
    //To process paths such as URLs
    // that always use forward slashes regardless of the operating
    // system, see the path package.
  • 在windows下filepath包处理出来的是反斜杠(\) 状态,拼接回去并且url上存在端口时就让url无法被解析, 例子: https://go.dev/play/p/g1q3Db72Yed
  1. getTsList 函数内, Url: fmt.Sprintf("%s/%s", host, line), 获取到的url不对,应该将下载m3u8的url和 m3u8内容里面的行都解析成url, 然后做一个 urlObj.ResolveReference(lineObj).String()
func resolveRefUrl(baseUrl string, extUrl string) (after string, errMsg string) {
	urlObj, err := url.Parse(baseUrl)
	if err != nil {
		return "", err.Error()
	}
	lineObj, err := url.Parse(extUrl)
	if err != nil {
		return "", err.Error()
	}
	return urlObj.ResolveReference(lineObj).String(), ""
}
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

1 participant