Skip to content

Commit

Permalink
chore : 음악 제목 길이 제한 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
sk000801 committed Nov 21, 2023
1 parent 02aff21 commit edb4249
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/src/upload/upload.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ export class UploadService {
this.objectStorage = nCloudConfigService.createObjectStorageOption();
}

private isValidPath(path: string) {
private isValidPath(path: string, fileName: string) {
for (let i = 0; i < pathPattern.length; i++) {
if (pathPattern[i].test(path)) {
return true;
if (i < 2) return true;
if (i == 2 && fileName.length <= 50) return true;
}
}

Expand All @@ -34,7 +35,7 @@ export class UploadService {
ext: string,
): Promise<string> {
try {
if (!this.isValidPath(keyPath) || !this.isValidExt(ext))
if (!this.isValidPath(keyPath, fileName) || !this.isValidExt(ext))
throw new HttpException('BAD REQUEST', HTTP_STATUS_CODE.BAD_REQUEST);

const url = await this.objectStorage.getSignedUrlPromise('putObject', {
Expand Down

0 comments on commit edb4249

Please sign in to comment.