File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
packages/electron-updater/src Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -157,14 +157,13 @@ export function newBaseUrl(url: string) {
157
157
// so, it makes sense only for Generic Provider for channel files
158
158
export function newUrlFromBase ( pathname : string , baseUrl : URL , addRandomQueryToAvoidCaching : boolean = false ) : URL {
159
159
const result = new URL ( pathname , baseUrl )
160
- let hasSearch = result . search != null && result . search . length !== 0
161
160
// search is not propagated (search is an empty string if not specified)
162
- if ( ! hasSearch && baseUrl . search ) {
163
- result . search = baseUrl . search
164
- hasSearch = true
161
+ const search = baseUrl . search
162
+ if ( search != null && search . length !== 0 ) {
163
+ result . search = search
165
164
}
166
- if ( addRandomQueryToAvoidCaching && ! hasSearch ) {
165
+ else if ( addRandomQueryToAvoidCaching ) {
167
166
result . search = `noCache=${ Date . now ( ) . toString ( 32 ) } `
168
167
}
169
168
return result
170
- }
169
+ }
Original file line number Diff line number Diff line change @@ -62,14 +62,14 @@ export class PrivateGitHubProvider extends BaseGitHubProvider<PrivateGitHubUpdat
62
62
}
63
63
64
64
private async getLatestVersionInfo ( cancellationToken : CancellationToken ) : Promise < ReleaseInfo > {
65
- let baseUrl = this . basePath
65
+ let basePath = this . basePath
66
66
const allowPrerelease = this . updater . allowPrerelease
67
67
68
68
if ( ! allowPrerelease ) {
69
- baseUrl = `${ baseUrl } /latest`
69
+ basePath = `${ basePath } /latest`
70
70
}
71
71
72
- const url = newUrlFromBase ( ` ${ baseUrl } ` , this . baseUrl )
72
+ const url = newUrlFromBase ( basePath , this . baseUrl )
73
73
try {
74
74
let version = ( JSON . parse ( ( await this . httpRequest ( url , this . configureHeaders ( "application/vnd.github.v3+json" ) , cancellationToken ) ) ! ! ) )
75
75
if ( allowPrerelease ) {
You can’t perform that action at this time.
0 commit comments