Skip to content

Commit

Permalink
Fix download modal with remote videos
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Jul 12, 2024
1 parent 300676f commit a454d63
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { VideoCaption, VideoFile, VideoFileMetadata, VideoSource } from '@peertu
import { logger } from '@root-helpers/logger'
import { videoRequiresFileToken } from '@root-helpers/video'
import { mapValues } from 'lodash-es'
import { firstValueFrom, of } from 'rxjs'
import { tap } from 'rxjs/operators'
import { firstValueFrom, of, throwError } from 'rxjs'

Check failure on line 22 in client/src/app/shared/shared-video-miniature/video-download.component.ts

View workflow job for this annotation

GitHub Actions / test (lint)

'throwError' is defined but never used
import { catchError, tap } from 'rxjs/operators'
import { InputTextComponent } from '../shared-forms/input-text.component'
import { GlobalIconComponent } from '../shared-icons/global-icon.component'
import { BytesPipe } from '../shared-main/angular/bytes.pipe'
Expand Down Expand Up @@ -161,12 +161,17 @@ export class VideoDownloadComponent {
}

private getOriginalVideoFileObs () {
if (!this.authService.isLoggedIn()) return of(undefined)
const user = this.authService.getUser()
if (!this.video.isLocal || !this.authService.isLoggedIn()) return of(undefined)

const user = this.authService.getUser()
if (!this.video.isOwnerOrHasSeeAllVideosRight(user)) return of(undefined)

return this.videoService.getSource(this.video.id)
.pipe(catchError(err => {
console.error('Cannot get source file', err)

return of(undefined)
}))
}

// ---------------------------------------------------------------------------
Expand Down

0 comments on commit a454d63

Please sign in to comment.