regex + revert test

This commit is contained in:
Gykes 2025-12-03 19:43:20 -08:00
parent 069fa3cffa
commit 67de6b1147
2 changed files with 3 additions and 9 deletions

View file

@ -445,7 +445,7 @@ func Test_PerformerStore_UpdatePartial(t *testing.T) {
url = "url"
twitter = "twitter"
instagram = "instagram"
urls = []string{instagram, twitter, url} // sorted alphabetically
urls = []string{url, twitter, instagram}
rating = 3
ethnicity = "ethnicity"
country = "country"

View file

@ -1,14 +1,8 @@
/**
* Extracts the sortable portion of a URL by removing the protocol and www. prefix
*/
function urlSortKey(url: string): string {
let key = url;
// Remove http:// or https://
key = key.replace(/^https?:\/\//, "");
// Remove www. prefix
key = key.replace(/^www\./, "");
return key.toLowerCase();
}
const urlSortKey = (url: string): string =>
url.toLowerCase().replace(/^(https?:\/\/)?(www\.)?/, "");
/**
* Sorts a list of URLs alphabetically by their base URL,