mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
regex + revert test
This commit is contained in:
parent
069fa3cffa
commit
67de6b1147
2 changed files with 3 additions and 9 deletions
|
|
@ -445,7 +445,7 @@ func Test_PerformerStore_UpdatePartial(t *testing.T) {
|
||||||
url = "url"
|
url = "url"
|
||||||
twitter = "twitter"
|
twitter = "twitter"
|
||||||
instagram = "instagram"
|
instagram = "instagram"
|
||||||
urls = []string{instagram, twitter, url} // sorted alphabetically
|
urls = []string{url, twitter, instagram}
|
||||||
rating = 3
|
rating = 3
|
||||||
ethnicity = "ethnicity"
|
ethnicity = "ethnicity"
|
||||||
country = "country"
|
country = "country"
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* Extracts the sortable portion of a URL by removing the protocol and www. prefix
|
* Extracts the sortable portion of a URL by removing the protocol and www. prefix
|
||||||
*/
|
*/
|
||||||
function urlSortKey(url: string): string {
|
const urlSortKey = (url: string): string =>
|
||||||
let key = url;
|
url.toLowerCase().replace(/^(https?:\/\/)?(www\.)?/, "");
|
||||||
// Remove http:// or https://
|
|
||||||
key = key.replace(/^https?:\/\//, "");
|
|
||||||
// Remove www. prefix
|
|
||||||
key = key.replace(/^www\./, "");
|
|
||||||
return key.toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts a list of URLs alphabetically by their base URL,
|
* Sorts a list of URLs alphabetically by their base URL,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue