Skip to content

Commit 0f689ea

Browse files
committed
fix(graphql-api): Use resolve in subtitles
1 parent 9cee414 commit 0f689ea

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/graphql-api/src/shared/subtitles/subtitles.service.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Download } from '@pct-org/mongo-models'
44
import { TorrentFile } from 'webtorrent'
55
import * as OpenSubtitles from 'opensubtitles-api'
66
import { createWriteStream } from 'fs'
7+
import { resolve } from 'path'
78

89
import { ConfigService } from '../config/config.service'
910
import { SubtitleInterface } from './subtitle.interface'
@@ -52,7 +53,10 @@ export class SubtitlesService {
5253
this.logger.log(`[${download._id}]: Search for subtitles`)
5354

5455
const filename = torrent.name
55-
const location = `${this.configService.get(ConfigService.DOWNLOAD_LOCATION)}/${download._id}`
56+
const location = resolve(
57+
this.configService.get(ConfigService.DOWNLOAD_LOCATION),
58+
download._id
59+
)
5660

5761
let imdbid = download._id
5862
let season = null
@@ -70,7 +74,7 @@ export class SubtitlesService {
7074
const subtitles = await this.client.search({
7175
sublanguageid: 'all',
7276
filesize: torrent.length,
73-
path: `${location}/${torrent.path}`,
77+
path: resolve(location, torrent.path),
7478
imdbid,
7579
filename,
7680
season,

0 commit comments

Comments
 (0)