mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Performer urls (#4958)
* Populate URLs from legacy fields * Return nil properly in xpath/json scrapers * Improve migration logging
This commit is contained in:
15
pkg/utils/url.go
Normal file
15
pkg/utils/url.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package utils
|
||||
|
||||
import "regexp"
|
||||
|
||||
// URLFromHandle adds the site URL to the input if the input is not already a URL
|
||||
// siteURL must not end with a slash
|
||||
func URLFromHandle(input string, siteURL string) string {
|
||||
// if the input is already a URL, return it
|
||||
re := regexp.MustCompile(`^https?://`)
|
||||
if re.MatchString(input) {
|
||||
return input
|
||||
}
|
||||
|
||||
return siteURL + "/" + input
|
||||
}
|
||||
Reference in New Issue
Block a user