Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot Autofix powered by AI
parent
1f31d7afae
commit
a8b31dae8a
@@ -286,8 +286,12 @@ func findEPUBCoverPath(rootPath string, pkg packageXML) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func cleanEPUBPath(rootPath, href string) string {
|
func cleanEPUBPath(rootPath, href string) string {
|
||||||
|
href = strings.TrimSpace(href)
|
||||||
|
if href == "" || strings.HasPrefix(href, "/") {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
joined := path.Clean(path.Join(rootPath, href))
|
joined := path.Clean(path.Join(rootPath, href))
|
||||||
if strings.HasPrefix(joined, "../") {
|
if joined == "." || strings.HasPrefix(joined, "../") || strings.HasPrefix(joined, "/") {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return joined
|
return joined
|
||||||
|
|||||||
Reference in New Issue
Block a user