Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ linters:
- '-QF1001' # disable rule 'Apply De Morgan’s law'
- '-QF1012' # disable rule 'Use fmt.Fprintf instead of x.Write(fmt.Sprintf(...))'
- '-QF1003' # disable rule 'Convert if/else-if chain to tagged switch'
- '-QF1004' # disable rule 'Use strings.ReplaceAll instead of strings.Replace'
# https://golangci-lint.run/usage/linters/#staticcheck
# https://staticcheck.dev/docs/configuration/options/#initialisms
initialisms:
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ func InstallProjectDependencies(
// In the future, this function can be extended to support other Git hosts, such as GitLab.
// TODO, @cchensh, we should get prepared for other non-Git hosts and refactor the create pkg
func generateGitZipFileURL(templateURL string, gitBranch string) string {
zipURL := strings.Replace(templateURL, ".git", "", -1) + "/archive/refs/heads/"
zipURL := strings.ReplaceAll(templateURL, ".git", "") + "/archive/refs/heads/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
zipURL := strings.ReplaceAll(templateURL, ".git", "") + "/archive/refs/heads/"
zipURL := strings.TrimSuffix(templateURL, ".git") + "/archive/refs/heads/"

🤔 This might've been an existing bug, but we might want to just trim the suffix here?

In this example the template URL for the project is changed in an unexpected fashion:

- https://github.com/slack-samples/example.git-project.git
+ https://github.com/slack-samples/example-project

I don't think we have a test that covers these cases, but it might be nice to cover this case with these changes 🙏 ✨

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is a great find! I doubt we have a test for this, so I'm leaning toward merging this PR (linter enablement) and follow-up with a new PR that fixes this issue w/ tests (fix: creating projects from a template url that contains .git).


if gitBranch == "" {
mainURL := zipURL + "main.zip"
Expand Down
Loading