Skip to content

Commit

Permalink
Merge pull request #700 from saschagrunert/cors-fix
Browse files Browse the repository at this point in the history
Modify release notes link to the allowed CDN
  • Loading branch information
k8s-ci-robot authored Nov 21, 2024
2 parents 0ecdf3c + 49bd868 commit be2cf6d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/app/notes/notes.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ export class NotesService {
* @returns Transformed URL
*/
private cdnLinkFromGsPath(path: string): string {
const allowedCorsLink = 'cdn.dl.k8s.io';
// Normalize the link if required
const regex = /^gs:\/\/[\w-/.]*\.json$/;
if (path.match(regex)) {
return path.replace(/^gs:\/\/[\w-]*\//, 'https://cdn.dl.k8s.io/');
if (path.match(/^gs:\/\/[\w-/.]*\.json$/)) {
return path.replace(/^gs:\/\/[\w-]*\//, `https://${allowedCorsLink}/`);
}
return path;

return path.replace(/dl\.k8s\.io/, allowedCorsLink);
}
}

0 comments on commit be2cf6d

Please sign in to comment.