Skip to content

Commit

Permalink
Merge pull request #33 from olegshulyakov/bugfix/243-error-execa-reso…
Browse files Browse the repository at this point in the history
…lve-main

jely2002#243 error execa resolve main
  • Loading branch information
olegshulyakov committed Jun 18, 2022
2 parents 3f0de75 + ef7fa1f commit 1f373cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions modules/BinaryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ class BinaryUpdater {
return null;
}
if (res.status === 302) {
const versionRegex = res.data.match(/[0-9]+\.[0-9]+\.[0-9]+/);
const urlRegex = res.data.match(/(?<=").+?(?=")/);
const redirectUrl = res.headers.location;
const versionRegex = redirectUrl.match(/[0-9]+\.[0-9]+\.[0-9]+/);
return {
remoteVersion: versionRegex ? versionRegex[0] : null,
remoteUrl: urlRegex ? urlRegex[0] : null,
remoteUrl: redirectUrl,
};
} else {
console.error('Did not get redirect for the latest version link. Status: ' + err.response.status);
Expand Down
4 changes: 2 additions & 2 deletions modules/Filepaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Filepaths {
this.packedPrefix = this.appPath;
this.unpackedPrefix = this.appPath + ".unpacked";
this.ffmpeg = this.app.isPackaged ? path.join(this.unpackedPrefix, "binaries") : "binaries";
this.ytdl = this.app.isPackaged ? path.join(this.unpackedPrefix, "binaries/yt-dlp-unix") : "binaries/yt-dlp-unix";
this.ytdl = this.app.isPackaged ? path.join(this.unpackedPrefix, "binaries/yt-dlp_macos") : "binaries/yt-dlp_macos";
this.icon = this.app.isPackaged ? path.join(this.packedPrefix, "renderer/img/icon.png") : "renderer/img/icon.png";
this.settings = this.app.isPackaged ? path.join(this.unpackedPrefix, "userSettings") : "userSettings";
this.taskList = this.app.isPackaged ? path.join(this.unpackedPrefix, "taskList") : "taskList";
Expand All @@ -69,7 +69,7 @@ class Filepaths {
this.packedPrefix = this.appPath;
this.unpackedPrefix = this.appPath + ".unpacked";
if(this.app.isPackaged) await this.createFolder(this.persistentPath);
this.ytdl = this.app.isPackaged ? path.join(this.persistentPath, "yt-dlp-unix") : "binaries/yt-dlp-unix";
this.ytdl = this.app.isPackaged ? path.join(this.persistentPath, "yt-dlp") : "binaries/yt-dlp";
this.ffmpeg = this.app.isPackaged ? this.persistentPath : "binaries";
this.icon = this.app.isPackaged ? path.join(this.packedPrefix, "renderer/img/icon.png") : "renderer/img/icon.png";
this.settings = this.app.isPackaged ? path.join(this.persistentPath, "userSettings") : "userSettings";
Expand Down
1 change: 0 additions & 1 deletion tests/BinaryUpdater.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ describe('getRemoteVersion', () => {
const axiosGetSpy = jest.spyOn(axios, 'get').mockRejectedValue({
response: {
status: 302,
data: "<a href=\"https://github.com/yt-dlp/yt-dlp/releases/download/2021.10.10/yt-dlp.exe\">",
headers: {
location: redirectURL
}
Expand Down

0 comments on commit 1f373cb

Please sign in to comment.