-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download Helm from redirect url. #7805
Conversation
if (typeof options === 'string') { | ||
options = redirectUrl; | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor this to a separate method call getRedirectOptions
import * as tl from "vsts-task-lib/task"; | ||
|
||
export async function download(url: any, downloadPath: string, printData: boolean): Promise<void> { | ||
export async function download(options: any, downloadPath: string, printData: boolean, isRedirectUrl: boolean = false): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename isRedirectUrl this to handleRedirect
reject(new Error('Failed to download file status code: ' + res.statusCode)); | ||
if(res.statusCode < 200 || res.statusCode >= 300) { | ||
if((res.statusCode >= 300 || res.statusCode < 400) | ||
&& !isRedirectUrl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor this to isRedirect
} | ||
|
||
function getRedirectOptions(options: any, redirectUrl: string): any { | ||
tl.debug("Download latest release from redirect uri: " + redirectUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the debug log from Download latest release … to something more meaningful. This method should not know that it is being used in download function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good looks very simple now. Thanks for making this change
No description provided.