@@ -402,13 +402,14 @@ func (p *Publisher) PublishToGcs(
402
402
return nil
403
403
}
404
404
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
412
413
}
413
414
414
415
// PublishReleaseNotesIndex updates or creates the release notes index JSON at
@@ -467,11 +468,7 @@ func (p *Publisher) PublishReleaseNotesIndex(
467
468
468
469
// Fixup the index to only use public URLS
469
470
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 )
475
472
}
476
473
477
474
versionJSON , err := p .client .Marshal (versions )
0 commit comments