File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -100,9 +100,16 @@ func GetProjects(client *http.Client) []types.ProjectDetails {
100100 // have double slashes.
101101 urlWithNoTrailingSlash := removeTrailingSlash (branch .FullUrl )
102102
103- // A change in Snooty Data API behavior means the branch name from the projects endpoint is no longer
104- // used to fetch the documents for that project. Instead, we should use the last segment of the URL.
105- version = getLastSegment (urlWithNoTrailingSlash )
103+ // If the docs project has only one branch, we can assume it's unversioned and just use "main" as
104+ // the version to fetch documents. i.e. https://www.mongodb.com/docs/mongodb-shell/
105+ if len (docsProject .Branches ) == 1 {
106+ version = "main"
107+ } else {
108+ // If the docs project has more than one branch, we need to use the active, stable branch name's
109+ // last segment of the URL as the version to fetch documents. i.e. https://www.mongodb.com/docs/atlas/operator/current/
110+ lastSegment := getLastSegment (urlWithNoTrailingSlash )
111+ version = lastSegment
112+ }
106113 prodUrl = urlWithNoTrailingSlash
107114 break
108115 }
You can’t perform that action at this time.
0 commit comments