Skip to content

Commit

Permalink
fix: correct username file system caching issues
Browse files Browse the repository at this point in the history
closes #24
  • Loading branch information
0-vortex committed Apr 19, 2023
1 parent 209d574 commit 076ace0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/social-card/social-card.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export class SocialCardController {
@Param("username") username: string,
@Res({ passthrough: true }) res: FastifyReply,
): Promise<void> {
const { fileUrl, hasFile, needsUpdate } = await this.socialCardService.checkRequiresUpdate(username);
const sanitizedUsername = username.toLowerCase();
const { fileUrl, hasFile, needsUpdate } = await this.socialCardService.checkRequiresUpdate(sanitizedUsername);

if (hasFile && !needsUpdate) {
return res.status(HttpStatus.FOUND).redirect(fileUrl);
Expand All @@ -55,7 +56,8 @@ export class SocialCardController {
@Param("username") username: string,
@Res({ passthrough: true }) res: FastifyReply,
): Promise<void> {
const { fileUrl, hasFile, needsUpdate, lastModified } = await this.socialCardService.checkRequiresUpdate(username);
const sanitizedUsername = username.toLowerCase();
const { fileUrl, hasFile, needsUpdate, lastModified } = await this.socialCardService.checkRequiresUpdate(sanitizedUsername);

return res
.headers({
Expand Down

0 comments on commit 076ace0

Please sign in to comment.