Skip to content

Commit

Permalink
fix(backend): correct encoding of non-english characters
Browse files Browse the repository at this point in the history
  • Loading branch information
jrafaaael committed Oct 10, 2023
1 parent 9250df7 commit f0eadd6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/src/rooms/rooms.controller.ts
Expand Up @@ -10,6 +10,7 @@ import {
import { FileInterceptor } from '@nestjs/platform-express';
import { RoomsService } from './rooms.service';
import { UploadedFileDto } from './dto/room-with-message.dto';
import { getCorrectEncoding } from 'src/utils/get-correct-encoding';

@Controller('rooms')
export class RoomsController {
Expand All @@ -32,7 +33,7 @@ export class RoomsController {
@Body() uploadedFile: UploadedFileDto,
) {
const room = await this.roomsService.create({
name: file.originalname,
name: getCorrectEncoding(file.originalname),
});
await this.roomsService.generateEmbeddings(file, room.id);

Expand Down
3 changes: 3 additions & 0 deletions backend/src/utils/get-correct-encoding.ts
@@ -0,0 +1,3 @@
export function getCorrectEncoding(str: string) {
return Buffer.from(str, 'latin1').toString('utf-8');
}

0 comments on commit f0eadd6

Please sign in to comment.