@@ -402,13 +402,14 @@ func (p *Publisher) PublishToGcs(
402402 return nil
403403}
404404
405- func gcsPathToPublisURL (gcsPath string ) (string , error ) {
406- const pathSep = "/"
407- split := strings .Split (strings .TrimPrefix (gcsPath , object .GcsPrefix ), pathSep )
408- if len (split ) < 2 {
409- return "" , fmt .Errorf ("invalid GCS path: %s" , gcsPath )
410- }
411- return URLPrefixForBucket (split [0 ]) + pathSep + strings .Join (split [1 :], pathSep ), nil
405+ // TODO: remove this function once https://cdn.dl.k8s.io/release/release-notes-index.json
406+ // is fixed.
407+ func FixPublicReleaseNotesURL (gcsPath string ) string {
408+ const prefix = "https://storage.googleapis.com/"
409+ for strings .HasPrefix (gcsPath , prefix ) {
410+ gcsPath = strings .TrimPrefix (gcsPath , prefix )
411+ }
412+ return gcsPath
412413}
413414
414415// PublishReleaseNotesIndex updates or creates the release notes index JSON at
@@ -467,11 +468,7 @@ func (p *Publisher) PublishReleaseNotesIndex(
467468
468469 // Fixup the index to only use public URLS
469470 for v , releaseNotesPath := range versions {
470- releaseNotesPublicURL , err := gcsPathToPublisURL (releaseNotesPath )
471- if err != nil {
472- return fmt .Errorf ("get publish URL from release notes GCS path: %w" , err )
473- }
474- versions [v ] = releaseNotesPublicURL
471+ versions [v ] = FixPublicReleaseNotesURL (releaseNotesPath )
475472 }
476473
477474 versionJSON , err := p .client .Marshal (versions )
0 commit comments