Skip to content

Commit 57edf3e

Browse files
committed
Fixes for HTTP and Soundcloud
1 parent 08c1a51 commit 57edf3e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/sources/HTTPSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class HTTPSource extends Plugin {
4242
const data = await HTTPSource.followURLS(resource);
4343

4444
const mimeMatch = data.headers["content-type"]?.match(mimeRegex);
45-
if (mimeMatch && mimeMatch[1] === "application" && !supportedApplicationTypes.includes(mimeMatch[2])) {
45+
if (!mimeMatch || (mimeMatch[1] === "application" && !supportedApplicationTypes.includes(mimeMatch[2]))) {
4646
data.end();
4747
data.destroy();
4848
throw new Error(`${"UNSUPPORTED_FILE_TYPE"} ${data.headers["content-type"]}`);

src/sources/SoundcloudSource.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import { Plugin } from "volcano-sdk";
44
import Util from "../util/Util.js";
55

66
const identifierRegex = /^O:/;
7-
const usableRegex = /^https:\/\/(?:on\.)?soundcloud.com/;
7+
const usableRegex = /^https:\/\/(?:on\.)?soundcloud\.(?:app\.goo\.)?(?:com|gl)/;
88
const onSoundCloudStart = "https://on.soundcloud.com/";
9+
const soundcloudAppGooglStart = "https://soundcloud.app.goo.gl/";
910

1011
class SoundcloudSource extends Plugin {
1112
public source = "soundcloud";
@@ -23,7 +24,7 @@ class SoundcloudSource extends Plugin {
2324
return { entries: results.map(SoundcloudSource.songResultToTrack) };
2425
}
2526

26-
if (resource.slice(0, onSoundCloudStart.length) === onSoundCloudStart) {
27+
if ((resource.slice(0, onSoundCloudStart.length) === onSoundCloudStart) || (resource.slice(0, soundcloudAppGooglStart.length) === soundcloudAppGooglStart)) {
2728
const socket = await Util.connect(resource);
2829
const request = await Util.socketToRequest(socket);
2930
if (!request.headers.location) throw e;

0 commit comments

Comments
 (0)