Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ export class CfnLspInstaller extends BaseLspInstaller {
throw error
}
},
} as any
} as any,
'sha256'
)
}

Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/shared/lsp/baseLspInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export abstract class BaseLspInstaller<T extends ResourcePaths = ResourcePaths,
constructor(
protected config: Config,
loggerName: Extract<LogTopic, 'amazonqLsp' | 'amazonqWorkspaceLsp' | 'awsCfnLsp'>,
private manifestResolver?: ManifestResolver
private manifestResolver?: ManifestResolver,
private readonly hashAlgorithm: string = 'sha384'
) {
this.logger = getLogger(loggerName)
}
Expand Down Expand Up @@ -56,7 +57,8 @@ export abstract class BaseLspInstaller<T extends ResourcePaths = ResourcePaths,
includePrerelease: true,
}),
manifestUrl,
this.downloadMessageOverride
this.downloadMessageOverride,
this.hashAlgorithm
).resolve()

const assetDirectory = installationResult.assetDirectory
Expand Down
7 changes: 3 additions & 4 deletions packages/core/src/shared/lsp/lspResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class LanguageServerResolver {
* Custom message to show user when downloading, if undefined it will use the default.
*/
downloadMessage?: string,
private readonly _defaultDownloadFolder?: string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this because it wasn't being used anywhere

private readonly hashAlgorithm: string = 'sha384'
) {
this.downloadMessage = downloadMessage ?? `Updating '${this.lsName}' language server`
}
Expand Down Expand Up @@ -294,7 +294,7 @@ export class LanguageServerResolver {
return [{ filename: fetchResult.filename, data }]
}

const hash = createHash('sha384', data)
const hash = createHash(this.hashAlgorithm, data)
if (hash === fetchResult.hash) {
return [{ filename: fetchResult.filename, data }]
}
Expand Down Expand Up @@ -501,7 +501,6 @@ export class LanguageServerResolver {
}

private getDownloadDirectory(version: string) {
const directory = this._defaultDownloadFolder ?? this.defaultDownloadFolder()
return `${directory}/${version}`
return `${this.defaultDownloadFolder()}/${version}`
}
}
Loading