<commit_before>package host

import "strings"

// ZipURL returns the URL of the zip archive given a github repository URL.
func ZipURL(url string) string {
	url = strings.TrimSuffix(url, "/")
	url = strings.TrimPrefix(url, "/")

	if strings.HasSuffix(url, "zip/master") {
		return url
	}

	// BUG filepath.Join trims slashes use url.Join
	return "https://codeload.github.com/" + url + "/zip/master"
}<commit_msg>Refactor github zip URL calculation<commit_after>package host

import (
	"path/filepath"
	"strings"
)

// ZipURL returns the URL of the zip archive given a github repository URL.
func ZipURL(url string) string {
	url = strings.TrimSuffix(strings.TrimPrefix(url, "/"), "/")

	if strings.HasSuffix(url, "zip/master") {
		return url
	}

	return "https://codeload.github.com/" + filepath.Join(url, "/zip/master")
}
{'fraction_non_alphanumeric': 0.13746958637469586, 'fraction_numerical': 0.0, 'mean_word_length': 4.111801242236025, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5587093', 'n_tokens_mistral': 290, 'n_tokens_neox': 271, 'n_words': 77}