Skip to content

Commit

Permalink
chore: allow access to files with invalid signatures (#1036)
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-w authored Oct 29, 2024
1 parent 9fcaa42 commit b4edf84
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BadRequestException, Injectable } from '@nestjs/common';
import { BadRequestException, Injectable, Logger } from '@nestjs/common';
import { ATTACHMENT_LG_THUMBNAIL_HEIGHT, ATTACHMENT_SM_THUMBNAIL_HEIGHT } from '@teable/core';
import { PrismaService } from '@teable/db-main-prisma';
import { UploadType } from '@teable/openapi';
Expand All @@ -19,6 +19,7 @@ import type { IRespHeaders } from './plugins/types';
@Injectable()
export class AttachmentsStorageService {
private readonly urlExpireIn: number;
private readonly logger = new Logger(AttachmentsStorageService.name);

constructor(
private readonly cacheService: CacheService,
Expand Down Expand Up @@ -81,7 +82,8 @@ export class AttachmentsStorageService {
if (!url) {
url = await this.storageAdapter.getPreviewUrl(bucket, path, expiresIn, respHeaders);
if (!url) {
throw new BadRequestException(`Invalid token: ${token}`);
this.logger.error(`Invalid token: ${token}`);
return '';
}
await this.cacheService.set(
`attachment:preview:${token}`,
Expand Down

0 comments on commit b4edf84

Please sign in to comment.