Skip to content

Commit

Permalink
fix(graphql-api): Use resolve in subtitles
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs committed Sep 20, 2020
1 parent 9cee414 commit 0f689ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/graphql-api/src/shared/subtitles/subtitles.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Download } from '@pct-org/mongo-models'
import { TorrentFile } from 'webtorrent'
import * as OpenSubtitles from 'opensubtitles-api'
import { createWriteStream } from 'fs'
import { resolve } from 'path'

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

const filename = torrent.name
const location = `${this.configService.get(ConfigService.DOWNLOAD_LOCATION)}/${download._id}`
const location = resolve(
this.configService.get(ConfigService.DOWNLOAD_LOCATION),
download._id
)

let imdbid = download._id
let season = null
Expand All @@ -70,7 +74,7 @@ export class SubtitlesService {
const subtitles = await this.client.search({
sublanguageid: 'all',
filesize: torrent.length,
path: `${location}/${torrent.path}`,
path: resolve(location, torrent.path),
imdbid,
filename,
season,
Expand Down

0 comments on commit 0f689ea

Please sign in to comment.