File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -255,8 +255,10 @@ export class Deluge implements TorrentClient {
255
255
config : Partial < AddTorrentOptions > = { } ,
256
256
) : Promise < AddTorrentResponse > {
257
257
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 ) {
260
262
const upload = await this . upload ( torrent ) ;
261
263
if ( ! upload . success || ! upload . files . length ) {
262
264
throw new Error ( 'Failed to upload' ) ;
@@ -265,7 +267,7 @@ export class Deluge implements TorrentClient {
265
267
path = upload . files [ 0 ] ;
266
268
} else {
267
269
/**
268
- * Assume paths starting with /tmp/ are from {@link Deluge.addTorrent }
270
+ * Assume paths starting with /tmp/ are from {@link Deluge.upload }
269
271
* Example temp path: /run/deluged-temp/delugeweb-s0jy917j/ubuntu-20.10-desktop-amd64.iso.torrent
270
272
*/
271
273
path = torrent ;
You can’t perform that action at this time.
0 commit comments