Skip to content

Commit 9db8382

Browse files
committed
it is early
1 parent 0a3806d commit 9db8382

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: src/deluge.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,10 @@ export class Deluge implements TorrentClient {
255255
config: Partial<AddTorrentOptions> = {},
256256
): Promise<AddTorrentResponse> {
257257
let path: string;
258-
if (isUint8Array(torrent) || !torrent.startsWith('/tmp/') || !torrent.includes('delugeweb-')) {
259-
console.log({ torrent });
258+
const isUploaded =
259+
typeof torrent === 'string' &&
260+
(torrent.startsWith('/tmp/') || torrent.includes('delugeweb-'));
261+
if (isUint8Array(torrent) && !isUploaded) {
260262
const upload = await this.upload(torrent);
261263
if (!upload.success || !upload.files.length) {
262264
throw new Error('Failed to upload');
@@ -265,7 +267,7 @@ export class Deluge implements TorrentClient {
265267
path = upload.files[0];
266268
} else {
267269
/**
268-
* Assume paths starting with /tmp/ are from {@link Deluge.addTorrent}
270+
* Assume paths starting with /tmp/ are from {@link Deluge.upload}
269271
* Example temp path: /run/deluged-temp/delugeweb-s0jy917j/ubuntu-20.10-desktop-amd64.iso.torrent
270272
*/
271273
path = torrent;

0 commit comments

Comments
 (0)